Fix: Execute all messages received from SQS #138
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
After the SimpleMessageListenerContainer has received SQS messages from a queue it does not check again, that the queue is still running and delivers all messages to their handlers even if the queue has stopped in the meantime.
💡 Motivation and Context
If a SimpleMessageListenerContainer is stopped, e.g. because the service instance is shut down, it might happen that while stopping, the container still receives some SQS messages from a queue, but doesn't distribute those messages to their handlers.
As a result, the SQS messages are invisible for other service instances that are listening to the same queue until the visibility timeout of the messages is reached. This causes a delay of the message delivery.
With this fix, all messages that are pulled from the queue - and thus set invisible - are delivered to their handlers and can therefore be processed, even if the SimpleMessageListenerContainer is stopped or the service is shut down.
💚 How did you test it?
Added a unit test:
📝 Checklist
🔮 Next steps