(2) and (4) communicate with each other using Kafka (3)
All components are stateless (except Kafka, right?)
First, Client initial a command to REST service using http POST (sync), then REST service take this command and forward it to Processor ms (after doing some conversion) via Kafka (async). After this step, REST service will sleep (this http scope) and wait the result from Processor ms
Then Processor ms handle this command and send the result back to REST service via Kafka (async). REST service wake up and and return the ResponseEntity to Client within same http scope.
Now we decide to migrate (2) to microservice to take advantage of this architecture. And the problem occurred: instance 1 of (2) send command to (4), and (4) send the result to instance 2. But the http session is established between (1) and instance 1, and instance 2 cannot return to (1). This returning must be done by and only by instance 1.
My first idea is, for example, let instance 1 be aware of the result from (4) no matter it was sent to which instance. But currently we have no solution to archive this idea.
This is the diagram
We need a "non work-around" solution for this architecture. Please help. Thank you
Note: we are unable to make change to blackbox components