Here is a sample code:
public override void Run(){ Client.OnMessage((receivedMessage) => { var APIResponse = Call3rdPartyAPIUsingMessageData(receivedMessage); }, options); }
The issue is that the 3rd party API call takes a long time. It seems silly to sit there and wait for the API call to complete synchronously.
What I would like is to take advantage of `async/await` to save the thread.
Meaning, I want the worker role to "pause this message" and process the next message in the queue. When the 3rd Party API call completes, then jump back in and complete the operation.
Looking at other answers on stackoverflow, it seems that using `async/await` in the worker role is not a good idea.
What are my options?
- Edited by sorcerdon2 Thursday, March 26, 2015 4:53 PM