[rabbitmq-discuss] How to handle AcknowledgeMode.MANUAL acknowledgements within handleMessage() method at consumer end?

Gary Russell grussell at gopivotal.com
Thu Jan 9 13:49:53 GMT 2014


You rarely  need to access the client API directly with Spring AMQP. See
the reference documentation
http://docs.spring.io/spring-amqp/docs/1.3.0.BUILD-SNAPSHOT/reference/html/

You can do the whole thing in Spring without needing to use the client API;
simply inject a RabbitTemplate into your listener call one of its send (or
convertAndSend) methods. The template will automatically use the same
channel (by default); you can then throw an exception and it will be
rejected/requeued,

void onMessage(String Message) {

    try {

    } catch (SomeException) {
        this.rabbitTemplate.converAndSend(someData);
        throw SomeRuntimeException();
    }
}

For Spring-AMQP specific questions, you can use our forum
http://forum.spring.io/forum/spring-projects/integration/amqp or the
spring-amqp tag on StackOverflow.




On Thu, Jan 9, 2014 at 6:09 AM, Michael Klishin <mklishin at gopivotal.com>wrote:

>
> On 9 Jan 2014, at 15:06, Rajasekhar P <sekhar434145 at gmail.com> wrote:
>
> > Am using spring amqp API, where the error is occurred inside
> handleMessage() method. Can you please let me know how can we do that?
>
> Channel#basicPublish.
>
> Please try to do a little bit of research on the Java client, spring-amqp
> does not try to completely replace it.
>
> MK
>
> Software Engineer, Pivotal/RabbitMQ
>
>
> _______________________________________________
> 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/20140109/5f7728b2/attachment.html>


More information about the rabbitmq-discuss mailing list