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

   Two ways the producer lost or broke a send.
   
   **1. A mixed list silently dropped everything that was not an exchange.**
   
   ```java
   if (exchange.getIn().getBody() instanceof List) {
       boolean groupedExchanges = false;
       for (Object body : exchange.getIn().getBody(List.class)) {
           if (body instanceof Exchange) { send((Exchange) body); 
groupedExchanges = true; }
       }
       if (!groupedExchanges) { send(exchange); }
   }
   ```
   
   The producer documents two shapes: a list of aggregated exchanges, or a 
single payload. A list
   holding both published only the exchanges and threw the other elements away 
without a word. It is now
   refused with a message saying how many of each it found. The two documented 
shapes are unchanged: a
   list of only exchanges is still published one message per exchange, and a 
list with no exchange in it
   is still published as one payload.
   
   **2. A header that does not convert to a String failed the send with a 
`NullPointerException`.**
   `putAttributes` rejects null, and the loop passed whatever `getHeader(name, 
String.class)` returned:
   
   ```java
   String value = exchange.getIn().getHeader(camelHeader, String.class);
   ...
   messageBuilder.putAttributes(camelHeader, value);
   ```
   
   so one unconvertible header aborted the publish. Those headers are now 
skipped (a Pub/Sub attribute
   cannot be null anyway) and logged at debug. Headers that do convert are 
unaffected, and the
   `HeaderFilterStrategy` still decides which ones travel.
   
   _Claude Code on behalf of oscerd_
   
   🤖 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