- Joined
- Sep 24, 2009
- Messages
- 1
- Reaction score
- 0
Hello all,
I'm going down the route of multithreading for a particular web app beause i think its the right way to go, if anyone reading this can suggest a better method, please let me know!
Heres my scenario (generalised):
I have a web application which sends a single Message to multiple websites / services. These recipients then give me a Response which indicates the message has been received (in the form of an XML string or a http 200 OK status, depending on where its gone to).
Problem: If on sending the Message i do not get the correct Response, the Message should go into a Message Queue and be saved to an appropriately named file. I'm avoiding logging to a db because if that is down and i lose messages the world will end for me. This Message Queue should periodically (every 5 minutes or so) try to resend any messages in it. The Message Queue is a simple thread safe singleton class containing a List<Message> property and a SendMessages method.
Now, this is where the water gets a bit merky for me, I am attempting to start a new thread in the init method of a httpmodule to handle this queueing but theoretically i think i would be creating a new thread every time the init is hit, which would become unmanageable and crash at some point.
Is there any way i can create a new thread specifically for this one task and check it exists before i go adding messages to the Message Queue?
Or, on the other hand, is there a better way to do this to solve the problem?
I've tried to be as clear as possible with my explanation but if you need any more info to give a suggestion please ask and i will do my best to provide more clearly,
Thanks for reading! :stupido:
I'm going down the route of multithreading for a particular web app beause i think its the right way to go, if anyone reading this can suggest a better method, please let me know!
Heres my scenario (generalised):
I have a web application which sends a single Message to multiple websites / services. These recipients then give me a Response which indicates the message has been received (in the form of an XML string or a http 200 OK status, depending on where its gone to).
Problem: If on sending the Message i do not get the correct Response, the Message should go into a Message Queue and be saved to an appropriately named file. I'm avoiding logging to a db because if that is down and i lose messages the world will end for me. This Message Queue should periodically (every 5 minutes or so) try to resend any messages in it. The Message Queue is a simple thread safe singleton class containing a List<Message> property and a SendMessages method.
Now, this is where the water gets a bit merky for me, I am attempting to start a new thread in the init method of a httpmodule to handle this queueing but theoretically i think i would be creating a new thread every time the init is hit, which would become unmanageable and crash at some point.
Is there any way i can create a new thread specifically for this one task and check it exists before i go adding messages to the Message Queue?
Or, on the other hand, is there a better way to do this to solve the problem?
I've tried to be as clear as possible with my explanation but if you need any more info to give a suggestion please ask and i will do my best to provide more clearly,
Thanks for reading! :stupido: