Answered Best way to create an end point that runs backgroud tasks

vladimir.rech

New member
Joined
Mar 27, 2020
Messages
1
Programming Experience
10+
Hi.

I'm working in a mission critical application and I have to create an end point that receives the parameters send to be processed some time and returns to the client application that the request was received.
The client application don't have to wait for the process result.
What is the best way to acomplish that between these options:

1. The end point fires a thread (System.Threading.Thread)
2. The end point stores data in Windows Queue to be processed by a worker.
3. The end point stores data on database to be processed by a worker.

Constraints:

1. The data sent to be processed can't be lost, it's part of a financial application.
2. The back end is a monolithic application and is distributed between 5 servers with load balancer.
3. At this moment we can't broke it in microsservices.

Thank's.
 
Well, of for Option 2 above you really meant "Windows Queue", then that option can be readily discarded because the Windows message queue is just in memory and when an app crashes or the machine is rebooted, all the messages are lost.

Now, on the other hand, if you actually meant Microsoft Messaging Queue (MSMQ), then it is a completely different story. The was designed by Microsoft to actually address the type of problem you are trying to solve with the features of persistence and reliability that you are looking for.
 
Your option 3 will end up be reinventing some kind of queue solution, be it MSMQ, RabbitMQ, or some other off the shelf messaging queue.

If you know what you are doing Option 3 is a very viable solution since you can fine tune things for just what you need without the overhead of some of the other solutions. But you'll have to be up to snuff to pull this off, especially since you are dealing with financial matters. A goof on your part can cost someone millions...
 
Back
Top Bottom