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

   ## Description
   
   Fixes [CAMEL-24193](https://issues.apache.org/jira/browse/CAMEL-24193). In 
the SQS-notification branch of `CloudTrailReloadTriggerTask` (the 
`aws-secret-refresh` task with `useSqsNotification=true`):
   
   1. **NPE on a missing queue.** `QueueDoesNotExistException` from 
`receiveMessage` was caught and only logged, leaving `messageResult` null, 
which was then dereferenced by `for (Message m : messageResult.messages())` — 
an NPE on every poll (swallowed by the outer catch and logged as an error). The 
loop is now guarded against a null receive result.
   2. **Queue never drained.** `deleteMessage` ran only inside `if 
(matchSecret) { if (isReloadEnabled()) { … } }` with a `break` after the first 
match, so non-matching messages — and everything when reload was disabled — 
were never deleted and were redelivered on every poll (unbounded queue growth). 
Every examined message is now deleted (matched → reload recorded; unmatched or 
malformed → discarded), so the queue is drained. A malformed body is logged and 
discarded rather than aborting the whole batch.
   3. **`ObjectMapper` per message** replaced with a single reused instance.
   
   ## Tests
   
   Adds `CloudTrailReloadTriggerTaskSqsTest` — verifies every message is 
deleted even when only some match (the drain fix; the old code deleted at most 
one), and that a missing queue does not throw / does not delete.
   
   ## Scope note
   
   Two behavior-sensitive observations in the same class are intentionally 
**not** included here: the CloudTrail-polling branch advancing its cursor by 
newest-event-time + 1000ms, and `matchSecret` using substring `contains()`. 
They can be addressed separately.
   
   ## Backport
   
   Same code on `camel-4.18.x` and `camel-4.14.x`; will be backported after 
merge (fixVersions 4.22.0 / 4.18.4 / 4.14.9).
   
   ---
   _Claude Code on behalf of oscerd_


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