Using timer in Webservice to access Message queues

I need to create a webservice which checks if there are any messages in the Message queue.
If there are messages it gets them and processes them as required.

I need the webservice to check these messages periodically every few minutes. I have never used a timer in the web service. Is this doable?

Any help will be greatly appreciated. I will be developing this web service in

Thanks in advance.
Who is Participating?
Well it can be done but not directly.

Create a webmethods call do work with a timer in it. The timer talks to the queue every tick. But this method has to be triggered by someone.

We can create another wbmethods called stop work which will write to a database or file which the DoWork method reads periodically to break the timer loop.

As far as i know there is no way for a web service to start behaving like a windows service and start pooling the moment the web service starts.
Jai STech ArchCommented:
Web Services are listeners, they should not be used to perform TIMER like tasks...

better to write a separate Serviced component(i mean like windows services) and and put it in the services which will always be listenning...
sorry for not being clear. What i meant by a timer was not the TIMER class in the framework but a while loop with a sleep. With this you wil be able to achieve exact what the timer does.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.