一、延迟和定时消息投递
1 xml中配置schedulerSupport属性为true
2 每小时都会发生消息被投递10次,延迟1秒开始,每次间隔1秒:
TextMessage message = session.createTextMessage("test msg");
message.setStringProperty(ScheduledMessage.AMQ_SCHEDULED_CRON, "0 * * * *");
message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, 1000);
message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD, 1000);
message.setIntProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT, 9);
- AMQ_SCHEDULED_DELAY :延迟投递的时间
- AMQ_SCHEDULED_PERIOD :重复投递的时间间隔
- AMQ_SCHEDULED_REPEAT:重复投递次数
- AMQ_SCHEDULED_CRON:Cron表达式