We have solved this problem using Azure Service Bus as we have two systems that cannot communicate directly with each other via API or other means, but both systems can communicate with Azure Service Bus. Here's how it works:
- Client (web site SPA - which we call "Wife") makes a call to its own backend server API.
- Server publishes the request to a message queue (queue A).
- The other system (which we call "Husband") is subscribed to message queue A, processes the request and publishes a response to another queue (queue B).
- The server in step 2 is subscribed to message queue B and has been waiting for a response. It peeks into the queue checking the response is for the same request sent in step 2 and responds to the client in step 1.
Works well. If the Husband (in step 3) is offline, for whatever reason, it processes the message when he wakes back up and publishes the response. The wife client app will timeout waiting for the response - there's a message saying that the data is unavailable at this time, but will be processed as soon as possible. In this case the message is important and we process the dead letter message later.