ActiveMQ延迟投递

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);
posted @ 2020-11-23 16:26  Covenant  阅读(167)  评论(0编辑  收藏  举报

ヾ(≧O≦)〃点我返回顶部嗷~