[
https://issues.apache.org/jira/browse/CAMEL-24086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-24086 started by Andrea Cosentino.
------------------------------------------------
> camel-aws2-sqs: FIFO batch send assigns the same MessageDeduplicationId to
> every entry
> --------------------------------------------------------------------------------------
>
> Key: CAMEL-24086
> URL: https://issues.apache.org/jira/browse/CAMEL-24086
> Project: Camel
> Issue Type: Bug
> Components: camel-aws2-sqs
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.14.9, 4.18.4, 4.22.0
>
>
> When sending a batch (a List body, or a String split by batchSeparator) to a
> FIFO SQS queue, every batch entry is built from the same Exchange and
> Sqs2Producer.configureFifoAttributes(SendMessageBatchRequestEntry.Builder,
> Exchange) derives the MessageDeduplicationId from that one Exchange via the
> configured MessageDeduplicationIdStrategy. The default
> ExchangeIdMessageDeduplicationIdStrategy returns exchange.getExchangeId(),
> which is identical for all entries of the batch.
> As a result every message in the batch is sent with the *same*
> MessageDeduplicationId, so a FIFO queue accepts the batch but silently drops
> all but the first message within the 5-minute deduplication window. This is
> silent message loss.
> Secondary issue in the same method: unlike the single-message overload, the
> batch overload does not null-check the group-id / dedup-id strategies, so a
> null strategy throws NPE.
> Code references (main): Sqs2Producer.java configureFifoAttributes batch
> overload (~line 243) and the batch build loops (~lines 122-134 and 142-153);
> ExchangeIdMessageDeduplicationIdStrategy returns exchangeId.
> Fix direction: for the batch path, derive a distinct, deterministic
> MessageDeduplicationId per entry (the strategy's per-exchange id plus the
> entry's position), skip setting it when the strategy returns null
> (content-based-deduplication queues via NullMessageDeduplicationIdStrategy),
> and null-guard the strategies like the single-message overload. The
> single-message send path is unaffected.
> Present on camel-4.18.x and camel-4.14.x - backport to both.
> Found during an agent-assisted audit of the AWS components; verified by
> reading the cited code.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)