Reputation: 33914
I'm building a .NET web service that will be consumed by a vendor's application, and I'm not sure how to accomplish the following:
I don't have control over the way the vendor accesses my service, and the method they're using to call it is synchronous, so I need to respond quickly to let the calling app continue its work. As I see it, there are two choices, though I'm open to others:
Are there any other ideas, or does one of these sound preferable?
Upvotes: 4
Views: 1548
Reputation: 60055
I think 1st is the only possible solution. 2nd is very bad design. Assume you process each request for 1 second, and there are 2 requests coming in 1 second in average. You will quickly run out of resources (because more and more threads will be used)
1st one is good because you have all control on how you will store and process requests. Good design is to have web service as frontend that will just answer "Success" and enqueue requests. As a persistent storage i recommend MSMQ or database. Then create a service app that will have pool of threads and will pick from queue(db).
Upvotes: 2
Reputation: 498904
Option 1 is the way to go, as the application already supports queueing.
As for an option 2 - you can start a worker thread from you web service, this will process the work and you can proceed to return "success" from the main thread.
Upvotes: 0
Reputation: 10552
Upvotes: 2