我正在尝试删除 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();
这部分在浏览器控制台中产生以下结果,这就是我愿意删除的:
我已经阅读了这个其他问题和答案,还有活动的 mq 系统常量,但没有办法删除计划。还尝试浏览文档,但到目前为止找不到任何有用的东西
ActiveMQ 是否甚至支持以编程方式管理计划?AMQP 解决方案会很棒,但 NMS 也值得赞赏。