@SqsListener(value = "foo", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void fooMethod(final String message) {
processEvents(message);
}
I am using spring-cloud-starter-aws-messaging - @SqsListener in my app which at startup loads foo queue just fine. But while the app is up and running processing events from the queue, if I want to change the queue to a different queue, say foo-test dynamically, is that possbile ?
Background: I am trying to run a test queue part of my deployment and the deployment would start with the test queue. Once messages from the test queue are processed and the test is successful, I want to dynamically change the queue to the production queue.
Please advise on how to achieve this. If there are alternative approaches, let me know. Thanks!
You can intercept DestinationResolver.resolveDestination() and change it:
resolveDestination is called once, when SqlListener is initialized