-
-
Notifications
You must be signed in to change notification settings - Fork 367
Description
Type: Bug
Component:
SQS
Describe the bug
SC AWS version: 3.4.0
When not-found-strategy is set to FAIL (spring.cloud.aws.sqs.queue-not-found-strategy=FAIL) and an expected queue does not exist, the application falls into an infinite loop with undefined state. The undefined state means that Tomcat server is stopped, the application is not working, but the JVM process is still running, e.g docker container is working and consuming resources until a host sends SIGKILL or SIGTERM signal.
Additionally if an SqsListener is created programatically by SqsMessageListenerContainer the other defined queue start consuming messages despite invalid configuration of one SqsListener. This message processing might be interrupted by graceful shutdown (due to invalid configuration) leading to the potential loss of messages that have already been consumed.
Sample
@SqsListener("${correct.queue.name}") public void processEvent(EventDTO eventDto) { //anything }
@Bean SqsMessageListenerContainer<GreetingEvent> sqsMessageListenerContainer(SqsAsyncClient sqsAsyncClient) { return new SqsMessageListenerContainer.Builder<GreetingEvent() .sqsAsyncClient(sqsAsyncClient).queueNames("another-correct-queue") .messageListener((message) -> { log.info("Received message {}", message); }).build(); }
@SqsListener("invalid-queue-name") public void onInvalidMessage(GreetingEvent event) { }