Using timer in Webservice to access Message queues

Posted on 2007-09-27
Last Modified: 2013-11-07
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.
Question by:YRKS
    LVL 21

    Accepted Solution

    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.
    LVL 14

    Assisted Solution

    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...
    LVL 21

    Expert Comment

    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.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now