Reputation: 31
Suppose I have single rabbitTemplate instance, and I call rabbitTemplate.send(Message)to publishe a message to RabbitMQ server.
What I want to do here are: 1. from publisher view , how to make sure the message is received by RabbitMQ ? 2. In the consumer side, I use the same rabbitTemplate to receive message in a thread, and I want to manually ack the message in the other thread.
Is there any way to manually ack the message by RabbitTemplate?
Thank you for any help.
Upvotes: 0
Views: 2903
Reputation: 174739
RabbitMQ is asynchronous so there's no way to "wait" for the message to be secured in the broker; you can enable publisher confirms to get confirmation that a message was delivered to a queue. See the documentation for more information.
You can't manually ack the message when using one of the receive*()
methods; you would have to drop down to the native API by using the execute()
method; in the callback, perform channel.basicGet(queue, false)
to receive the message and then channel.basicAck(deliveryTag)
.
Upvotes: 3