[rabbitmq-discuss] Callback - handleDelivery

Michael Klishin mklishin at gopivotal.com
Fri Feb 7 07:29:01 GMT 2014


On 7 Feb 2014, at 05:00, cw storm <cwstorm at gmail.com> wrote:

> It has to be done inside the "handleDelivery".  It works if I perform the "doInvoke" outside of the "handleDelivery".
> 
> try {
>           channel.basicConsume(strQueueName, false,
> 		new DefaultConsumer(channel) {
> 			@Override
> 			public void handleDelivery(String consumerTag,
> 							Envelope envelope,
> 							AMQP.BasicProperties props,
> 							byte[] body)
> 			throws IOException
> 			{
> 
> 				 try
> 				 {
>                                         Service.doInvoke(NSName, pipeline);
> 				 }
>                                  catch (Exception e) {
> 					}
>                			}
> 		});
> } catch (Exception e1) {
> }

Deliveries are dispatched to a thread pool (j.u.c. executor service). Make sure your code
is prepared for that. Also, posting a stack trace would help.

MK

Software Engineer, Pivotal/RabbitMQ




More information about the rabbitmq-discuss mailing list