1、在activemq.xml中的broker标签中添加配置 schedulerSupport="true"
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" schedulerSupport="true">
2、在消息发送体中添加properties
// 延迟投递时间
message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY,delay);
// 延迟投递次数间隔
message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD,period);
// 延迟投递次数
message.setIntProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT,repeat);