1

I have two Services, A and B, which communicates between each other through SQS. I want to cower the service A with end-to-end tests. I invoke some action in this service, and as an answer, it must post a message to SQS. The problem is that I cannot retrieve this message in the test because the service B has subscribed on them and read them before I invoke "get message from SQS". Two more problems: I cannot stop the service B and I cannot change the service A (for example, writing a message to a log right before posting it to SQS)

How can I solve this?

1
  • pto3 given @John Rotenstein's answer I am curious what solution you may have found. Possibly to provide any hints here?
    – fraxture
    Jun 4, 2022 at 7:52

1 Answer 1

0

No, it is not possible to "intercept" or "watch" a message posted into SQS.

One option would be to have Service A send the message to a different queue, which your testing service then monitors to retrieve a message. It can then re-send the message in the 'real' queue. However, if you are unable to change the behaviour of Service A, then this is not an option.

So, unless you can modify the code in Service A or Service B, you won't be able to monitor the message going between the services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.