Here is the solution I found
@RestController @RequestMapping("/jms") public class JmsController { @Autowired ApplicationContext context; @RequestMapping(value="/halt", method= RequestMethod.GET) public @ResponseBody String haltJmsListener() { JmsListenerEndpointRegistry customRegistry = context.getBean("jmsRegistry", JmsListenerEndpointRegistry.class); customRegistry.stop(); return "Jms Listener Stopped"; } @RequestMapping(value="/restart", method=RequestMethod.GET) public @ResponseBody String reStartJmsListener() { JmsListenerEndpointRegistry customRegistry = context.getBean("jmsRegistry", JmsListenerEndpointRegistry.class); customRegistry.start(); return "Jms Listener restarted"; } @RequestMapping(value="/stopApp", method=RequestMethod.GET) public @ResponseBody String stopApp() { String[] args={}; SpringApplication.run(FacturationApplicationFrontDaemon.class, args).close(); return "stopped"; } }
source share