I have multiple instances of service A deployed where each service produces the request X events to SQS, which triggers the lambda functions and produces the various response events for that request submitted by particular service A instance. I would like to deliver these response events stored in a ActiveMQ topic such that each service A instance should only get the response events of a request it is submitted to queue. I can scale the number of service A instances horizontally.
For example, I have 2 instances of service A named instance1 & instance2. the instance1 submits the request to SQS with request id 1 and the instance2 submits the request to same SQS with request id 2 (request id is unique). The SQS will trigger the lambda functions, will produces the response events for request id 1 & 2 after lambda processing, stores them in a ActiveMQ topic (single one). The instance 1 & 2 are subscribers for this topic and the instance 1 should only get the response events of the request 1 and similary for instance 2.
Can we write a filtering logic for this? or can we fulfil this with Redis pub-sub? Kindly help.