Search code examples
asynchronousmicroservicesamqpservicebus

MicroServices - Async Communication via AMQP with multiple receivers scenario


Using Micro Services approach, I have Service A with 3 instances (A1, A2, A3) that can communicate with Service B which has (B1, B2, B3) instances via AMQP Message based Async communication. Example, by Azure Service Bus queues.

Part of Service A's action implementation, I have 5 Steps to be taken care and 2nd step of the 5 is to reach out to Service B to get some info and proceed further.

When I have a multi receiver approach, how does A2 instance of Service A can handle response from Service B, while actual request was made by A1 instance.

I would like to know how these kind of scenarios handled in multi sender + multi receiver approach in micro services.


Solution

  • In order to be posibile that the response from any of the service B instances to be handled by any of the service A instances then the response from B must contain all the information necessary to identify the request from A and resume the process, i.e. an Entity ID, Processs ID or something that most probable is opaque to B.

    Also, this means that A1 (or whatever instance sends the request message to B) should not block or wait for the response from B.