davsclaus opened a new pull request, #30608:
URL: https://github.com/apache/camel/pull/30608

   [CAMEL-25737](https://issues.apache.org/jira/browse/CAMEL-25737)
   
   ## What was wrong
   
   With `extendMessageVisibility=true` the timeout extender of the `aws2-sqs` 
consumer runs every `max(1, visibilityTimeout / 2)` whole seconds, and extends 
a message once 80% of its visibility timeout has passed. With 
`visibilityTimeout=1` every extension after the first came exactly when the 
message became visible again, so SQS answered `MessageNotInflight` and another 
consumer received the message while the first one still processed it (876 of 
2000 seeds of the SQS simulation with 2 or 3 consumers). With 
`visibilityTimeout` 0 or negative the endpoint passed the existing check, but 
the consumer did not create the extender, so `extendMessageVisibility` was 
silently ignored.
   
   ## The fix
   
   As proposed in the ticket:
   - `Sqs2Component` rejects an endpoint with `extendMessageVisibility=true` 
and a `visibilityTimeout` below 2 seconds, next to the existing check that 
`visibilityTimeout` is set.
   - `Sqs2Consumer` logs a WARN at startup when the `visibilityTimeout` is 
below 10 seconds, as the extension then has only 1 to 2 seconds left.
   - The `visibilityTimeout` and `extendMessageVisibility` option descriptions 
and the component page recommend 10 seconds or more; upgrade-guide note for the 
new startup failure.
   
   The extender timing itself is unchanged (scheduling it in milliseconds is 
the possible follow-up noted in the ticket).
   
   ## Tests
   
   - `SqsComponentConfigurationTest`: `visibilityTimeout` -1, 0 and 1 with 
`extendMessageVisibility=true` throw; 2 is accepted. The three new cases fail 
without the fix.
   - `SqsWorld` / `SqsVisibilityDstTest`: dropped the note that 
`-Ddst.sqs.visibilityTimeouts=1` shows this bug, since 1 is now rejected.
   - `mvn -o package` in `camel-aws2-sqs`: 1599 tests, 0 failures (including 
the 1000 + 500 DST seeds).
   
   Generated files regenerated: component JSON, catalog JSON and doc copy, 
endpoint DSL and component DSL.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to