How to create a queue
I have an application that hits a third party web service to create an email account after a customer clicks a button. However, sometimes the web service takes more than 1 minute to respond, which is a way to wait a long time for my clients to sit there waiting for a response.
I need to develop a way to set up a queuing service external from a website. This way I can add the web service action to the queue and tell the client that it can take up to 2 minutes to create an account.
I am wondering how to do this. My initial thought is to request actions through a database table that will be checked on a regular basis using the Console app that runs through Windows Scheduled tasks.
Any problems with this method?
Is there a better way you can think of?
a source to share
What if you are using a combination of AJAX and Windows Service?
On the website side: When a person decides to create an email account, you add a query to the database table. If they want to wait, provide a webpage using AJAX to check every time (10 seconds?) Whether their account has been created or not. If it's an app-style website, you can let them continue and display a message after creating an account. If they don't want to wait, they close the page or view another and maybe get an email after that.
On the processing side: create a windows service that checks the table for new requests. Once this is done with the request, it must somehow communicate with the user, perhaps setting a status flag on the request. This is what the AJAX call will look for. You can also send an email at this point.
If you use a scheduled task with a console application instead of a Windows service, you run the risk of multiple instances running at the same time. You will need to implement some kind of locking mechanism (at the application or request level) to prevent handling the same thing twice.
a source to share
Unfortunately, your question is too vague to answer any real details. If this is something you want to manage outside of the main application, then a windows service would be a little more appropriate and then create a console ... In terms of integration and lifecycle management, this provides a great addition to add other functionality (e.g. performance counters hosted by Management Services in WCF, Remoting, etc.). MSMQ is great, although there is a little more in deployment. If you're willing to invest time, there are many benefits to using MSMQ. If you really want to create your own queue point, there are many examples on the internet to serve as an example. Here's one, http://www.smelser.net/blog/page/SmellyQueue-(Durable-Queue).aspx .
a source to share