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

Gary Russell grussell at vmware.com
Fri Feb 22 15:40:09 GMT 2013


As I mentioned on the Spring forum - the rabbit template will use the same channel as the listener (by default). If the listener is transactional, the send won't complete until the transaction commits (handler exits). 


http://forum.springsource.org/showthread.php?135102-Problems-when-sending-a-message-while-receiving-using-RabbitMQ-RabbitTemplate&p=439178&posted=1#post439178 

----- Original Message -----

From: "Marco Pas" <marco.pasopas at gmail.com> 
To: rabbitmq-discuss at googlegroups.com 
Sent: Friday, February 22, 2013 9:06:52 AM 
Subject: [rabbitmq-discuss] Problems when sending a message while receiving 

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 
_______________________________________________ 
rabbitmq-discuss mailing list 
rabbitmq-discuss at lists.rabbitmq.com 
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss 

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


More information about the rabbitmq-discuss mailing list