mercredi 1 février 2023

Better C# design pattern where I need a poll logic to invoke a synchronous API [closed]

I am building a c# application(.net core 6), calling a Synchronous API(Let's call this ABC API) using an HTTP client. This sync API has many SOAP API methods, most of which I will invoke.

But I also need to devise a mechanism where I must invoke 'Method A' multiple times a day based on different timestamps(this info I will get from another method). Basically, I need a timer logic based on different timestamps.

Apart from this, I have to invoke Method B regularly for every second to check for updates.

Since I must not try asynchronous mode to invoke ABC API, I was thinking to use a lock on my 'HTTP Client' and ensure a single call at a time.

I am wondering if there is any better way to make sure I am calling this API synchronously and also use a better polling logic.

Please advice.

Aucun commentaire:

Enregistrer un commentaire