Claus Ibsen created CAMEL-25925:
-----------------------------------
Summary: camel-aws2-sqs - sendBatchMessage with more than 10
entries keeps only the last request's response as the body
Key: CAMEL-25925
URL: https://issues.apache.org/jira/browse/CAMEL-25925
Project: Camel
Issue Type: Bug
Components: camel-aws2-sqs
Affects Versions: 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
CAMEL-24196 made {{sendBatchMessage}} send more than 10 entries, in requests of
10 (the SQS limit). Afterwards the body is the {{SendMessageBatchResponse}} of
the last request only (camel-aws2-sqs, {{Sqs2Producer.sendBatchEntries}} on
main):
{code:java}
for (int i = 0; i < entries.size(); i += MAX_BATCH_ENTRIES) {
...
lastResult = amazonSQS.sendMessageBatch(request);
totalFailed += ObjectHelper.isNotEmpty(lastResult.failed()) ?
lastResult.failed().size() : 0;
totalSuccessful += ObjectHelper.isNotEmpty(lastResult.successful()) ?
lastResult.successful().size() : 0;
}
Message message = getMessageForResponse(exchange);
message.setBody(lastResult);
{code}
So with 25 messages the body has the results of the last 5. The
{{CamelAwsSqsFailedMessageCount}} and {{CamelAwsSqsSuccessfulMessageCount}}
headers count all 25, but which of the first 20 failed, with their ids and
error codes, is lost. A route that retries or logs the failed entries cannot
see them.
*Proposed change*: the body has the results of all the requests: one
{{SendMessageBatchResponse}} with all the {{successful}} and {{failed}}
entries, and the component documentation says so.
Related, in the same operation: an {{Iterable}} body with an element that is
not a String fails with a {{ClassCastException}} ({{entry.messageBody((String)
o)}}), where converting the element to a String would send it.
In 4.22.0 and 4.23.0.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)