Announcement Announcement Module
Collapse
No announcement yet.
Amqp acknowledgement Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 06:04 AM.

  • #2
    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.

    Comment


    • #3
      Hi,

      for example if your consumer implements ChannelAwareMessageListener :

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

      Comment


      • #4
        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.

        Comment

        Working...
        X