ActiveMQ的message.setDeliveryMode无效

通过上面的调试分析,了解到,尽管设置了某一条消息的deliveryMode,但是在底层最终发送消息时,还是会再次设置message的deliveryMode,若要指定某一条消息的deliveryMode,可以使用producer的send的另一个重载方法:

public void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
    this.send(this.getDestination(),
              message,
              deliveryMode,
              priority,
              timeToLive);
}
this.defaultDeliveryMode = Message.DEFAULT_DELIVERY_MODE; // 默认为2
this.defaultPriority = Message.DEFAULT_PRIORITY; // 默认为4
this.defaultTimeToLive = Message.DEFAULT_TIME_TO_LIVE; // 默认为0L

参考:https://blog.csdn.net/john1337/article/details/81635080

相关文章:

  • 2021-08-22
  • 2021-08-01
  • 2021-08-22
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-03
  • 2021-07-31
猜你喜欢
  • 2021-07-21
  • 2021-09-29
  • 2021-07-24
  • 2021-08-22
  • 2022-12-23
  • 2021-11-18
相关资源
相似解决方案