【发布时间】:2020-12-28 21:19:04
【问题描述】:
我正在尝试删除 ActiveMQ 中的计划作业,但到目前为止还没有成功。
使用NMS API 或Amqpnetlite 与消息一起创建计划(openwire lib 除外,因为该库未更新且不能在 netstandard/netcore 上使用)
用于使用 NMS 创建计划的示例代码,与 AMQP 库相同:
var factory = new Apache.NMS.ActiveMQ.ConnectionFactory(brokerUri);
IConnection connection = factory.CreateConnection(user, password);
connection.Start();
ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
IDestination dest = session.GetQueue(destination);
IMessageProducer producer = session.CreateProducer(dest);
producer.DeliveryMode = MsgDeliveryMode.NonPersistent;
var msg = session.CreateTextMessage("Sample text message");
msg.Properties.SetString("AMQ_SCHEDULED_CRON", "* * * * *");
producer.Send(msg);
connection.Close();
这部分在浏览器控制台中产生以下结果,这就是我愿意删除的:
我读过this other question and answer,也读过active mq system constants,但日程安排不会被删除。还尝试浏览文档,但到目前为止找不到任何有用的东西
ActiveMQ 是否甚至支持以编程方式管理计划? AMQP 解决方案会很棒,但 NMS 也很受欢迎。
【问题讨论】:
标签: activemq nms apache-nms amqp.netlite