我不知道如果ActiveMQ是一个合适的工具在这里...取消ActiveMQ消息
我有一个任务队列和多个消费者,所以我的想法是使用ActiveMQ的发布任务,然后由消耗消费者。
但我需要能够取消任务,如果它尚未处理...
是否有从队列中删除的ActiveMQ消息的API?
Destination destination = session.createQueue(TOPIC_NAME);
MessageProducer producer = session.createProducer(destination);
ObjectMessage message = session.createObjectMessage(jobData);
producer.send(message);
...
producer.cancel(message); (?)
用例是由于任何原因,不再需要执行该任务,并且该任务是耗费资源的。
你的意思是取消消息,如果他们没有交付给任何消费者在给定的时间点? –
@SagarRohankar准确地说,一旦交付,他们不会再排队了...... –
这将有助于:http://activemq.apache.org/how-do-i-purge-a-queue.html –