Guarantee response to specific node? (Microservices intercommunication)

0

Hi
I'm trying here to solve the problem of guaranteed response to the specific service node with SQS intercommunication, maybe some of you can hint me with solution

Description:
Imagine we have an API Gateway service which is scaled with multiple nodes under a load balancer.
During the REST request from the front-end, one of the random API Gateway Node (AGN in future) is hit with GET request. To fulfil this request AGN needs to request additional information from one of the internal microservices. So AGN drops the request to the Q of the specific microservice and requires a response in return.
Obviously, whole intercommunication is stateless, all services are scaled and any random node of this microservice can read request from the Q.
However initial AGN still holds an active HTTP connection which requires a response so microservice will drop its response to the API getaway Q, where potentially any of API Gateway node can pick it up, but we require this response to be delivered to the specific node, which still has an active connection from the front-end and waiting for response.

See the attached diagram: https://www.screencast.com/t/H1B1eLJex

Question:
How do I guaranty that only a specific node will pick up the response message from the Q and not the other node? I would imagine just SQS is not enough, then what other AWS service can I use, to some sort of subscribe for response and get notified when data is ready to pick it up?

Edited by: VSBryksin on May 17, 2019 7:52 AM

Edited by: VSBryksin on May 17, 2019 7:52 AM

질문됨 5년 전178회 조회
1개 답변
0

Hi VSBryksin,

For this pattern of request/response communication, you generally want to create a response queue per node rather than a single response queue. The requester will attach the URL of its specific response queue to the request message, so the responder (your microservice nodes in this case) know where to send the response.

We have a client-side library in developer preview specifically designed to make setting this up easier, if you are interested: https://github.com/awslabs/amazon-sqs-java-temporary-queues-client

Cheers,
robin-aws

AWS
답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠