Today I ran into problems with embedded ActiveMQ broker in Spring Framework. The goal is to run local application, which uses Spring context to start AMQ and after this application is finished, AMQ should stop.
My setup of spring context xml is following (I’m using the amq schema and this is only the needed part).
context = new ClassPathXmlApplicationContext("client-local-context.xml");
ComputingStarterService computingStarterService = (ComputingService)context.getBean("computingStarterService");
computingStarterService.start("Test");
And the problem is, that the main part of application stops, but the AMQ is still running. I tried a lot of things and the only working thing is to use
context.close();
I don’t know if there is another way to stop embedded AMQ. How it works eg. in JUnit tests?
How stop embedded ActiveMQ in Spring
Today I ran into problems with embedded ActiveMQ broker in Spring Framework. The goal is to run local application, which uses Spring context to start AMQ and after this application is finished, AMQ should stop.
My setup of spring context xml is following (I’m using the amq schema and this is only the needed part).
And the app looks like this:
And the problem is, that the main part of application stops, but the AMQ is still running. I tried a lot of things and the only working thing is to use
I don’t know if there is another way to stop embedded AMQ. How it works eg. in JUnit tests?