I'm using ActiveMQ with Spring , I have set the /SchedulerSupport / but seems not to work. Below is my configuration. ============================ @Configuration @EnableJms public class MessageConfig { private static final String DEFAULT_BROKER_URL = "tcp://localhost:61616";
public static final String DESTINATION_FB = "fb"; private static final String USER_NAME = "admin"; private static final String USER_PASSWORD = "admin"; @Profile("embedded") @Bean(initMethod = "start", destroyMethod = "stop") public BrokerService brokerService() throws Exception { BrokerService brokerService = new BrokerService(); brokerService.setSchedulerSupport(true); brokerService.addConnector(DEFAULT_BROKER_URL); return brokerService; } @Bean public ConnectionFactory connectionFactory() { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(DEFAULT_BROKER_URL); /* connectionFactory.setUserName(USER_NAME); connectionFactory.setPassword(USER_PASSWORD);*/ connectionFactory.setTrustedPackages(Arrays.asList("com.test.test", "java.lang")); return connectionFactory; } @Bean public JmsTemplate jmsTemplate(ConnectionFactory factory) { JmsTemplate template = new JmsTemplate(); template.setConnectionFactory(factory); template.setDefaultDestinationName(DESTINATION_FB); return template; } @Bean public DefaultMessageListenerContainer jmsListenerContainerFactory(ConnectionFactory connectionFactory){ DefaultMessageListenerContainer containerFactory = new DefaultMessageListenerContainer(); containerFactory.setConnectionFactory(connectionFactory); return containerFactory; } } ========Sender============ @Component public class MessageSender { @Autowired JmsTemplate jmsTemplate; public void sendMessage(final ResultCode data) { jmsTemplate.send(new MessageCreator(){ @Override public Message createMessage(Session session) throws JMSException { ObjectMessage objectMessage = session.createObjectMessage(data); objectMessage.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY,600000); return objectMessage; } }); } } =======Receiver===== @Component public class MessageReceiver { @JmsListener(destination = MessageConfig.DESTINATION_FB) public void receiveMessage(ResultCode data) { System.out.println("Received <" + data.getInfo() + ">"); } } Thanks for your reading -- View this message in context: http://activemq.2283324.n4.nabble.com/scheduler-message-deliver-immediately-tp4718568.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.