Send a message when receiving using Grails / RabbitMQ / RabbitTemplate

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Send a message when receiving using Grails / RabbitMQ / RabbitTemplate

marcopas
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

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email