473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is it common to delegate most of the legwork to Windows services?

I want a process to be running always and it is supposed to do a lot of
stuff like:

1. reading and writing to files
2. watching a file system folder
3. communicating with COM components
4. communicating with other C DLLs
5. Watching for email from a POP3 server
6. Sending email using SMTP
7. Fetching data from SQL Server
8. Writing data to SQL Server
Is it common to have a Windows service directly do all this? Or would
it be better to make a regular exeucutable that is hidden do all this?
Or could you recommend a better architecture?

Jun 11 '06 #1
2 1268
Not enough information.

If you want a process to watch something. a windows service is a good idea.
If you want to have something go off on a regular cycle that is not
conducive to the standard windows scheduler, a service is a good option.

As for whether all of the functions are wrapped or some are setup as pieces
of software that are fired by the service (web service front end, COM+,
executable) is largely dependent on your needs. In most cases, you will find
few items that need to be wrapped up completely in a service.

Hope that helps.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Water Cooler v2" <wt*****@yahoo.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
I want a process to be running always and it is supposed to do a lot of
stuff like:

1. reading and writing to files
2. watching a file system folder
3. communicating with COM components
4. communicating with other C DLLs
5. Watching for email from a POP3 server
6. Sending email using SMTP
7. Fetching data from SQL Server
8. Writing data to SQL Server
Is it common to have a Windows service directly do all this? Or would
it be better to make a regular exeucutable that is hidden do all this?
Or could you recommend a better architecture?

Jun 11 '06 #2


What I do is this:

I still write "business layer" objects. I write objects... and don't really
consider the windows service part of it.

I start with an Interface

interface IWorker (or something like that .. it doens't matter)
the interface has 2 methods

StartWorker
StopWorker
Then I write a object which implements the IWorker

SmtpWorker : IWorker

//implement StartWorker
//implement StopWorker
...
Ok.... Then I'll write the windows service.

The windows service has its own Start and Stop methods.

I actually use reflection to construct one of my IWorker's .. which in this
first case is SmtpWorker

When the windows service code kicks in (the .Start method..) it will call
the IWorker.StartWorker method.

...

The reason I do this .. is that my WindowsService code is alot cleaner.
And if I ever need a scheduled task, all I have to do is write a quickie
console app.
I put NO logic whatsoever in the windows service. Just the code to create
any of my IWorker's...
and to call its methods.

I use a config file to house my reflection information

See my blog:
http://spaces.msn.com/sholliday/ 12/1/2005 entry

#3 is what I'm talking about.

The other advantage of the IWorker interface. is that if I need 3 different
functionalities to work with my one windows service...then I can just create
a collection of IWorkers,and call the StartWorker on each of the items in
the collection.
this is where the OO... and polymorphism of the methods makes things really
nice.
.............


"Water Cooler v2" <wt*****@yahoo.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
I want a process to be running always and it is supposed to do a lot of
stuff like:

1. reading and writing to files
2. watching a file system folder
3. communicating with COM components
4. communicating with other C DLLs
5. Watching for email from a POP3 server
6. Sending email using SMTP
7. Fetching data from SQL Server
8. Writing data to SQL Server
Is it common to have a Windows service directly do all this? Or would
it be better to make a regular exeucutable that is hidden do all this?
Or could you recommend a better architecture?

Jun 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Budi | last post by:
Hi, We try callback C# method from C++ DLL using delegate, using delegate without argument works fine for me however the CallBackFunctionWithParameter which call delegate with parameter crash...
1
by: paul | last post by:
I have a Windows vb.net app that creates an Object from a .net dll that I wrote. If the dll fails to achieve its task I get it the re-throw an exception. the windows app encapulates the object...
3
by: Michael Tissington | last post by:
I'm confused by documentation and examples on using Delegate to create Events for use with COM In some situation I see a parameter list of (sender as Object, e as EventArgs) and other times I...
5
by: needin4mation | last post by:
Learning about delegates (again, I admit), I think I finally get it, maybe. I can reference any method in any class in the same namespace as long as it has the same signature. Right? But how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.