davsclaus opened a new pull request, #26569:
URL: https://github.com/apache/camel/pull/26569
The check that flags a `Camel*` header no component in the file sets only
went further than "the value would be null" when a real header was spelled
similarly. In a timer-triggered route there is no message source to name, so a
beginner or a model writes `CamelFromEndpoint` or `CamelEndpointUri` for "which
endpoint did this come from", nothing is close, and the message gave nothing to
write instead.
The message now:
- answers the intent behind the name when no real header is close: endpoint
or route (`${exchange.fromEndpoint}`, `${routeId}`,
`${header.CamelToEndpoint}`), size or count (`${body.length()}`,
`${bodyAs(byte[]).length}`, `${headers.size()}`), time (`${date:now:...}`,
`${date:exchangeCreated:...}`, and when `${messageTimestamp}` is set);
- always lists the headers of the first component in the file (the trigger),
not only the owner of a did-you-mean match, and the timer's exchange properties
whenever a timer is used;
- ends with the rule that a header no component sets stays null unless a
`setHeader` step sets it earlier in the route.
Before, for a timer route logging `${header.CamelFromEndpoint}`:
```
Line 22: header CamelFromEndpoint is not set by timer (the value would be
null)
```
After:
```
Line 22: header CamelFromEndpoint is not set by timer (the value would be
null). For the endpoint or route a message came from use
${exchange.fromEndpoint} or ${routeId}; for the endpoint it was last sent to,
${header.CamelToEndpoint}. The timer headers are CamelTimerFiredTime. timer
sets the exchange properties CamelTimerCounter, CamelTimerName,
CamelTimerPeriod, CamelTimerTime (${exchangeProperty.CamelTimerCounter}). A
header no component sets stays null unless a setHeader step sets it earlier in
the route.
```
Every expression named was checked against a running route
(`${headerNames.size()}` does not exist and `${messageTimestamp}` is 0 on a
timer route, so neither is suggested). The check is shared by `camel validate`,
the camel-jbang-mcp write and validate tools and the editor integrations. Three
tests added.
🤖 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]