During working on a pet project in microservice event driven architecture, I've faced a problem of delivering responses to a client.
Each microservice (API Gateway etc) has many replicas and has it's own loadbalancer (Kubernetes Service).
Use case:
20 clients (JS App) sends "Register account request"
10 clients get connected to "API Gateway 1" and 10 - "API Gateway 2". Gateways hold connection (long polling)
Each API Gateway delegates request processing to Data Processors via Apache Kafka, topic "registerAccount"
Data processors are subscribed to "registerAccount" topic. onMessage() registers account and push new account's ID back to Kafka, topic "newAccountId"
API Gateways receive newAccountId (which one? all of them?)
API Gateways send newAccountId to appropriate client (how can API Gateway decide which client must receive this newAccountId?)
The only resolution I've found is to add client id to each message and then filter messages.
Have anybody experienced such problem?