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

   ## Summary
   
   An item of [CAMEL-26911](https://issues.apache.org/jira/browse/CAMEL-26911): 
**`camel trace --action=clear` and `camel receive --action=clear` lost the next 
batch.**
   
   The CLI connector of an integration appends one line of JSON per batch to 
`~/.camel/<pid>-trace.json` (and `<pid>-receive.json`), and the CLI reads the 
file line by line. The clear wrote an empty JSON object without a new line, so 
the next batch the connector appended joined it on the same line:
   
   ```
   {}{"traces":[...]}
   ```
   
   That line does not parse, and its traces (or received messages) were skipped 
by `camel trace`, `camel receive` and the tools that read the file.
   
   ### Fix
   
   The clear empties the file. The connector appends only what is newer than 
the last batch it wrote (by uid), so the next batch is the first line.
   
   ## Tests
   
   - `CamelTraceActionTest.clearEmptiesTheTraceFile` and 
`CamelReceiveActionTest.clearEmptiesTheReceivedMessages`: the file is empty 
after the clear, and the next batch, appended as the connector does, is a line 
that parses.
   - camel-jbang-core passes locally.
   
   _Claude Code on behalf of Claus Ibsen (davsclaus)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS
   


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