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

   ## Description
   
   The runtime half of CAMEL-24844, the cheap part. The body's class at each 
step existed only in the backlog tracer's dumps (`body.type` in 
`MessageHelper.dumpAsJSon`), so it was there for the last completed exchange in 
dev mode and nowhere else; the message history proper carried node and elapsed 
time only.
   
   `MessageHistory` gets two default methods, `getBodyType()` (the canonical 
class of the body as the node was reached, null when not captured) and 
`getBodySize()` (bytes, -1 when not captured or unknown). 
`DefaultMessageHistoryFactory` fills them when history is on: the type is one 
`getClass()`, the size is the `MessageSizeStrategy`'s (lengths of bytes, 
strings, stream caches and files, element counts of collections; no reading, no 
conversion) and only when that strategy is enabled, which the dev profile does. 
No message copy.
   
   The Message History table printed with a failure gains two columns:
   
   ```
   Source                                   ID                             
Processor                                          Elapsed (ms) Body type       
                 Size
   route1/route1                            ...
   route1/a                                 ...                                 
                                                           java.lang.String     
               11
   route1/b                                 ...                                 
                                                           byte[]               
               11
   route1/c                                 ...                                 
                                                           java.util.ArrayList  
                3
   ```
   
   so a person or a model reading a failure sees where the body turned from 
text into a Map or bytes, on every message, without the tracer. A custom 
`MESSAGE_HISTORY_HEADER_FORMAT` / `MESSAGE_HISTORY_OUTPUT_FORMAT` with the old 
four placeholders keeps working (the extra arguments are ignored by 
`String.format`).
   
   Next, as follow-ups: the exception messages name the type reaching the step 
from the history ("the body reaching this step is a java.util.LinkedHashMap, 
set by unmarshal at line 12"), and the TUI and the camel-jbang-mcp history tool 
show the two columns.
   
   ## Tests
   
   - `MessageHistoryBodyTypeAndSizeTest`: a route where the body goes from text 
to bytes to a list, the type and size per step, and both columns in the table.
   - The existing message history and `MessageHelper` tests of camel-core green 
(24).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj


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