Avatar
1
anaconda875 Beginner
anaconda875 Beginner
Sync to Async http request and response architecture
REST serviceClientProcessor microservices
(4).
Kafka
(3)
All components are stateless (except Kafka, right?)
ClientREST serviceREST serviceProcessor msKafkaREST serviceProcessor ms
Processor msREST serviceKafkaREST serviceClient
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
<img class="content-img" src="https://stackask.com/wp-content/uploads/2022/12/Untitled.png" />
We need a "non work-around" solution for this architecture. Please help. Thank you
Note: we are unable to make change to blackbox components
  • Answer
architecture
Remain: 5
1 Answer
Avatar
tvd12 Enlightened
tvd12 Enlightened
The Best Answer
In this situation, you can give every message an ID, and then when a processor broadcast a response to the both instances of REST service, you can check the message ID and forward the response to the client.
But I think kafka is not suitable for RPC and for your situation. You can use gRPC, it's more suitable.
  • 1
  • Reply