0

I am calling an external services from my server, I need to send coordinate data (which is sent from a mobile app) to the service and get back the receipt. This service often goes down for a while. What is a good practice to retry sending the data (after a quite long period of time : say an interval of 1 hours) and ensure that there is no duplication.
Thank you.

Manh Quang
  • 91
  • 1
  • 9
  • Possible duplicate of [Retrying HttpClient Unsuccessful Requests](https://stackoverflow.com/questions/19260060/retrying-httpclient-unsuccessful-requests) – rickvdbosch Dec 03 '18 at 10:33
  • try http://www.thepollyproject.org/ – jazb Dec 03 '18 at 10:34
  • sorry - i did not read this properly. i would still use something similar to Polly but looks like you need a queue of jobs. each job would have a status to hold onto the info as to whether it had been sent or not. i would persist this in the db – jazb Dec 03 '18 at 10:48

3 Answers3

1

The Polly library is probably your best bet.

https://github.com/App-vNext/Polly

Gerade Geldenhuys
  • 139
  • 1
  • 3
  • 12
1

Polly is a great library in this regard, however polly abstracts many design patterns useful for different scenarios. In your case you can use polly and look specifically for "Circuit breaker" and "retry" patterns. For best retry policy encapsulate circuit breaker in Retry.

Imran Arshad
  • 3,794
  • 2
  • 22
  • 27
0

You can Keep the coordinate in LocalDB of the mobile app if the service request fails, and try sending the coordinate from the LocalDB after the interval, and delete the coordinate if it can be sent successfully.

  • Actually user sometimes does not turn on wifi/4G on their phone and we need the data very soon so we need to send the data from our server to the service – Manh Quang Dec 03 '18 at 23:01