The fail consists on not delivering the message to the rabbitmq container.
When receiving the message in:
Code:
void handleMessage(Message message) {
// send a message to the exchange and waits for the reply..
String result =
rabbitTemplate.convertSendAndReceive("myCustomExch", "myRoutingKey",
"test content")
It waits on the convertSendAndReceive method for 5 seconds (default timeout) and the consumer never gets the message. The reply is null! Moving this line to a Grails controller for example then the method is executed without any problems. The consumer gets the message and a reply is received.
So my guess is that i am not allowed to make a call to a convertAndSend or convertSendAndReceive when i am already inside a handleMessage method.
The config used in the grails project is al follows..
Code:
queues = {
exchange name: 'defaultExch', type: direct, durable: true, {
defaultQueue durable: true, binding: "myDefaultRoutingKey"
}
exchange name: 'myCustomExch', type: direct, durable: true, {
myQueue durable: true, binding: "myRoutingKey"
}
}
So to elaborate a bit more..
A message arrives on the 'defaultQueue' the handleMessage method is being called,
inside the handleMessage method i try to send a message to another Queue but then this call actually seems to get
a timeout. Both handleMessage methods are called by rabbitTemplate.convertSendAndReceive
Code:
rabbitTemplate.convertSendAndReceive("defaultExch", "myDefaultRoutingKey", "test content")
Code:
rabbitTemplate.convertSendAndReceive("myCustomExch", "myRoutingKey", "test content")