Multi-threading and windows service application help needed
Posted on 2011-05-10
I have a requirement for a messaging application which can loop through any number of databases and use the data to assemble messages and process. The databases are independent of each other but share the same application logic. I'm writing in C# and using the .net framework v3.5.
I would like to create a windows service application which does the following:
1. At timed intervals, say 30 seconds, loops through and checks each database to see if any messages need processing
2. Create a new messaging object for each database and run the process on its own thread until the work is finished
Each new object may take from anything between a few milliseconds to a minute to complete.
I'm new to threading so I'm not sure about the best way to handle this and which technologies are best to use in a windows service. I have already created the application which works with one database at a time and already made sure that static fields are marked with the ThreadStaticAttribute.
Can someone help get me started with a simple example or suggest any good tutorials for such an exercise?