Start and Stop JMS Listener using Spring

后端 未结 3 1398
半阙折子戏
半阙折子戏 2020-12-16 23:35

So question is how to temporary stop and start a jms listener created using spring using the fallowing way :



        
3条回答
  •  半阙折子戏
    2020-12-16 23:56

    You can also get a hold of the messageListenerContainer, and invoke stop() on it:

    @javax.annotation.Resource //autowire by name
     private AbstractJmsListeningContainer myMessageListenerContainer;
    
     myMessageListenerContainer.stop();
    
     I'm using the more verbose setup of this container:
     
     
     
     
     
     
    

    Here you see that you can set autoStartup to false if you don't want the listenerContainer to automatically start.

提交回复
热议问题