I have a Spring application that has methods annotated with Spring's @JmsListener. The application is deployed on multiple nodes. On some specific nodes I need to disable the JMS listener so that it is not pulling messages off the queue.
There appears to be a way to stop the listener after the application has started up. But this appears to leave open the brief window between startup and when the disable code runs where the application instance may consume messages. So instead is there a way to disable the listener during application startup.