Results 1 to 3 of 3

Thread: AUTO_ACKNOWLEDGE mode in conjunction with a single threaded client

  1. #1
    Join Date
    May 2011
    Posts
    1

    Default AUTO_ACKNOWLEDGE mode in conjunction with a single threaded client

    Hi

    I am consuming messages from a JMS queue. It is very important that I consume messages in the order they are placed on the queue. Hence I am using a pool with a single thread in my client message consumption code.

    I am using AUTO_ACKNOWLEDGE acknowledgement mode. Hence if an exception occurs while proessing a particular messages from the queue the message will not get dequeued.

    I have configured the queue such that the client has 20 re-attempts to re-consume and successfully process the message. I have also configured the interval between re-attempts to be 2 secs.

    My question is, if I fail to process a particular message and the retry interval is 2 secs will subsequent messages placed on the queue be processed - please bare in mind I am using a pool with a single thread?

    Thanks

  2. #2
    Join Date
    Jul 2008
    Posts
    26

    Default

    The JMS client's ability to consume messages in the order that they were placed on the queue is dependent upon the message broker and its ability to dispatch messages in that order. Some message brokers do this by default while others need to be configured in this manner.

    Bruce

  3. #3
    Join Date
    Dec 2008
    Posts
    11

    Default

    I would also like to point out that the AUTO_ACKNOWLEDGE mode means that the session is NOT transacted, which means the message won't stay in the queue if an exception occurs. Here is the Spring javadoc on this:

    The listener container offers the following message acknowledgment options:

    * "sessionAcknowledgeMode" set to "AUTO_ACKNOWLEDGE" (default): Automatic message acknowledgment before listener execution; no redelivery in case of exception thrown.
    * "sessionAcknowledgeMode" set to "CLIENT_ACKNOWLEDGE": Automatic message acknowledgment after successful listener execution; no redelivery in case of exception thrown.
    * "sessionAcknowledgeMode" set to "DUPS_OK_ACKNOWLEDGE": Lazy message acknowledgment during or after listener execution; potential redelivery in case of exception thrown.
    * "sessionTransacted" set to "true": Transactional acknowledgment after successful listener execution; guaranteed redelivery in case of exception thrown.

Posting Permissions

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