Carlos Roman created CAMEL-5761:
-----------------------------------

             Summary: Update SqsConsumer to extend Visibility Timeout correctly
                 Key: CAMEL-5761
                 URL: https://issues.apache.org/jira/browse/CAMEL-5761
             Project: Camel
          Issue Type: Bug
          Components: camel-aws
    Affects Versions: 2.10.2
            Reporter: Carlos Roman


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).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to