Reputation: 77
I would like to now if is posible to implement this idea with RabbitMQ and Spring Integration:
Best regards!
Upvotes: 1
Views: 148
Reputation: 121177
Something like this:
@Transactional
public Message getMessageFromQueue(String queue) {
try {
return this.rabbitTemplate.receive(queue);
}
finally {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
}
With the transaction scope we will poll the queue within transaction. With the setRollbackOnly()
we rallback TX and, therefore, return the message to the queue back.
Upvotes: 1