Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5761

Update SqsConsumer to extend Visibility Timeout correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.10.2
    • 2.10.3, 2.11.0
    • camel-aws
    • Patch Available
    • Unknown

    Description

      Currently SqsConsumer will scheduled a future to happen start occruing 1/2 the visibility timeout, and reoccur again at the visibility timeout period. Because of the way SQS works, when you request a ChangeMessageVisibility timeout it does not add that to the time remaining on the message visibility. Instead it will set the message visibility to the time out given. This means that what actually happens in the camel code is that:

      • we request the ChangeMessageVisibility timeout to be set to X seconds from now after X/2 seconds
      • then every X seconds after that we we request the ChangeMessageVisibility timeout to be set to X from now

      This means that our message will become visible every now and again as the ChangeMessageVisibility timeout is not updated in time as period between successive executions is the same as the timeout period we request.

      I've attached two patches which would fix this issue.

      • "aws_sqs_visibility_timeout_simple.patch" - This patch changes the way we set up the future. The delay and period are now the same so that we call ChangeMessageVisibility every X/2 after the message has been pulled.
      • "aws_sqs_visibility_timeout_phased_timeout.patch" - This one keeps the delay to 1/2 the period and requests ChangeMessageVisibility every period. This time though it requests the visibility to be 1.5 * the period. This means that it behaves as originally planned, as if it was adding duration to the visibility duration left. This means we call Amazon less times and still keep the message hidden as expected.

      This was looked at with Alex Hutter (both working on same project).

      Attachments

        Issue Links

          Activity

            People

              njiang Willem Jiang
              carlosroman Carlos Roman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: