0

I am working on a helper library that is supposed to send some data to a server on a specified interval, e.g. 1 minute.

The idea is that the user of this library should not have to bother with plugging in the event handlers, disposing etc. Whatever app is using it, the helper library should take care of going to app data, look for some files and post them to a server once a minute.

The library is supposed to send telemetry data to the server. A developer in the code will specify when a piece of data is supposed to be sent - but I don't want to send it on that instance - instead, I want to batch the requests and send them on an interval. Therefore, the data is first stored locally, and only send to server later.

I was thinking about using System.Timers.Timer for the job, but... If the parent app is killed or crashes, the timer would still be there, triggering the On_Elapsed event.

How would you implement this kind of functionality? Perhaps something different than a timer?

The goals:

  • Zero/minimum configuration for the developer using this framework
  • Send batched data from time to time, rather than as soon as data appears
  • The application should specify an instance of a Telemetry Client class - but it might specify more than one instance, or specify it more than once - and I don't want tens of timers running in the background...

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.