By using AWS re:Post, you agree to the Terms of Use

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

1 Answer
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

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions