Results 1 to 4 of 4

Thread: Amqp acknowledgement

  1. #1
    Join Date
    Aug 2012
    Posts
    16

    Default Amqp acknowledgement

    Hi,
    I'm using spring amqp with rabbitmq as my message broker.How can u acknowledge the message from the queue manually after processing it (using simplemessagelistneradapter)?
    Last edited by tec; Aug 11th, 2012 at 06:04 AM.

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    If you are using a spring-amqp listener container, you typically don't need to use manual acknowledgment - 'auto' acknowledgement in spring-amqp means the container will ack the message when the thread returns normally or reject (nack) it if an exception is thrown. This should not be confused with what rabbit calls auto-ack; that is called NONE in spring-amqp.

    If, however, you do want to use manual acknowledgment, you can do so, but you have to use a ChannelAwareListener so you can invoke basicAck or basicReject.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    May 2012
    Posts
    6

    Default

    Hi,

    for example if your consumer implements ChannelAwareMessageListener :

    Code:
    	//ack messages
    	channel.basicAck(message.getMessageProperties().getDeliveryTag(), true);
    yannick.

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    You can have your service activator on the error-channel throw an exception but, as you point out, it will loop indefinitely if the message fails every time (sometimes called a poison message). Unless you can detect/track the number of attempts and consume the message after a certain number of tries.

    Yes, a retry interceptor with appropriate policies for retry and recovery can do all this for you. If you configure a RejectAndDontRequeueRecover, the poison message can be sent to the DLE.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •