Hello guys
Happy to join community. I have a question regarding the VisibilityTimeout behaviour.
I use sqs in testcontainers with localstack image and it seems like comand below doesn’t work at all.
localStack.execInContainer(“awslocal”, “sqs”, “set-queue-attributes”, “–queue-url”, sqsEndpoint + “/” + JOB_QUEUE_NAME, “–attributes”, “VisibilityTimeout”, “43200”);
I have the next flow:
put the message in queue
read it using @SqsListener(value = “${queueName}”, deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS) (awspring version: 2.3.2 + the latest testcontainers version and the latest localstack image version)
process event
and then there’s the part that probably influences that behaviour. This is verification step in test.
When the verifycation block is running my consumer get the event second time and start executing process from scratch but how can it happen if I set the biggest possible delay before next consume?
I think that while the conditions in the untilAsserted block are being checked (checking for calls to wiremock, receiving messages from the queues where I send the corresponding messages) the message is sent to processing again because the test has not been completed and the process is still alive.
It is also strange that my message was not instantly deleted from the queue after processing, because I have this parameter deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS.
in the logs when the message gets re-queued after the visibility timeout expired.
With the information we have so far I can’t really say much. I’d suggest running localstack with DEBUG=1 and looking into the logs to see what’s going on. In particular I would double check whether the message deletion works correctly!