locked
Reusable Timer Service RRS feed

  • Question

  • I'm new to .NET, C# and MSRS. I'd like to create a timer service similar to the one in Tutorial 2 except that I would like a client to have the ability to configure 1..n  timers to fire notifications at different time intervals. I'm looking for a design pattern. I'm thinking that there would be n separate timer partner instances created depending on the configuration requested by the client.
    Monday, August 13, 2007 2:29 PM

Answers

  • Other than service Tutorial 2 there is a timer sample service at samples\Misc\Utility\Timer. You can make a copy of the Timer sample and modify it with the changes that George suggested.

    Monday, August 20, 2007 3:35 AM

All replies

  •  

    you can have a service instance per timer configuration. The service reads its configuration from a file or gets it from a Replace message on starup(its state type is the timer definition class a mention above). Other services start their own private instance, with custom parameters.

     

    Alternatively you can have a single service, that keeps a list of timer configurations (some simple class you define that has the a friendly timer name, timer interval, repeat count etc). Other services can send Insert messages to add a timer, Delete messages to remove one, etc.

     

    For notifications, service can send Subscribe messages ( a custom SubscribeRequest that derives from our SubscribeRequestType) that specifies the name of the timer you want to subscribe.

     

    The timer service cam then use Submit to submit notification tot he subscription manager, using the timer name as the "key" (so only services subscribed to this timer get the notification).

    Monday, August 13, 2007 11:41 PM
  • Other than service Tutorial 2 there is a timer sample service at samples\Misc\Utility\Timer. You can make a copy of the Timer sample and modify it with the changes that George suggested.

    Monday, August 20, 2007 3:35 AM