Ostap Koziy
Ostap Koziy

Reputation: 167

How to override SqsConfiguration to return custom implementation of SimpleMessageListenerContainer

In our Spring boot application we use Spring Cloud AWS:

to receive messages from a SQS queue. However we need to be able to start the application even if the queue is not accessible (i.e "(Service: AmazonSQS; Status Code: 403; Error Code: AccessDenied"). In order to do that, we need to be able to override the org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration class, and provide our own implementation of org.springframework.cloud.aws.messaging.listener.SimpleMessageListenerContainer.

What is the correct way to do this, and not break autowiring in our existing code?

Upvotes: 1

Views: 1515

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

You have to declare @Bean for the custom SimpleMessageListenerContainerFactory, but still leave @EnableSql and SqsConfiguration will be @Autowired with your customization.

Upvotes: 0

Related Questions