我们需要知道来自生产者的消息是否已经传递到队列,而不是传递给消费者。这基本上是检查队列是否存在的另一种方式。
我们正在使用驼峰路由为我们的RabbitMQ消息,我们需要一个发布者确认。我知道RabbitMQ客户端提供了发布者确认,但是我想知道Camel是否支持这个功能。我们正在使用Camel,如下所示。
@Produce(uri = "direct:event")
private ProducerTemplate producer;
void method() {
producer.sendBodyAndHeaders("content", HashMapHeaders);
//Confirm the acknowledgement
}发布于 2016-09-13 17:40:07
Camel确实支持publisher confirms (请参阅official documentation),您只需通过将publisherAcknowledgements属性设置为true并通过publisherAcknowledgementsTimeout属性指定一个超时间隔来启用它们:
to("rabbitmq://localhost/A?routingKey=B&publisherAcknowledgements=true&publisherAcknowledgementsTimeout=10000")请注意,support for this feature从Camel2.17.0开始可用。
https://stackoverflow.com/questions/39466135
复制相似问题