List of usage examples for org.springframework.jms.listener AbstractJmsListeningContainer start
@Override public void start() throws JmsException
From source file:samples.ConsumerApplication.java
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); context.registerShutdownHook();//from w ww . ja v a 2s . c om boolean sync = true; if (args != null && args.length > 0) { sync = Boolean.valueOf(args[0]); } if (sync == true) { //Example of a sync consumer with Spring JMS SpringJmsConsumer consumer = (SpringJmsConsumer) context.getBean("springJmsConsumer"); consumer.run(); ((org.springframework.jms.connection.CachingConnectionFactory) context.getBean("connectionFactory")) .resetConnection(); } else { //Example of an async consumer with Spring JMS (autoStartup is normally set to true) AbstractJmsListeningContainer listenerContainer = (AbstractJmsListeningContainer) context .getBean("listenerContainer"); listenerContainer.start(); } }