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

   # Description
   Fixes [CAMEL-23883](https://issues.apache.org/jira/browse/CAMEL-23883).
   
   With `useIterator=true`, the Kafka producer splits an `Iterable` body into 
one record per element. A Jackson `JsonNode` implements `Iterable`, so a scalar 
value node (e.g. the `IntNode` from `transform().jq(".my-value")`) was seen as 
an empty iterable: the loop ran zero times, `send()` was never called, and the 
message was silently dropped with no exception or log.
   
   This narrows `isIterable()` so a `JsonNode` counts as a batch only when it 
is a container node (`isContainerNode()`). Scalar nodes now take the 
single-message path, so they are either delivered or fail with a clear 
serialization error, never silently dropped. Container nodes 
(`ArrayNode`/`ObjectNode`) are still split, unchanged.
   
   ## Open question / possible follow-up
   
   This fixes the reported Jackson case, but the same silent drop could recur 
for any body  that is `Iterable` yet yields an empty iterator. An exception 
isn't safe (an empty `Collection` is a legitimate no-op).  
   Would be worth adding a DEBUG log when the iterable path produces zero 
records?  
   I'm happy to add it here or in a follow-up PR.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   
   
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   


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