[rabbitmq-discuss] Problems when sending a message while receiving

Marco Pas marco.pasopas at gmail.com
Fri Feb 22 14:06:52 GMT 2013


HI there i am trying to send a message in the handleMessage method,
this seems to fail somehow. Is there a reason why i cannot send a
message to rabbitMQ when processing a message?

// receives a message and replies to the reply queue
void handleMessage(Message message) {

    // send a message to the exchange and waits for the reply..
    String result =
rabbitTemplate.convertSendAndReceive("myCustomExch", "myRoutingKey",
"test content")

    // determine the reply queue
    def destQueue = message.messageProperties.replyTo

    // code omitted that processes the message and uses the previously 
result
    ....

    // send the content back to the reply queue
    rabbitSend destQueue, responseJson
}

When i put the rabbitTemplate.convertSendAndReceive("myCustomExch",
"myRoutingKey", "test content") method in a non handleMessage method
it works without problems. Am i not allowed to send and receive inside
a handleMessage method that is also handling stuf?

/Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130222/1882399f/attachment.htm>


More information about the rabbitmq-discuss mailing list