davsclaus opened a new pull request, #27229: URL: https://github.com/apache/camel/pull/27229
_Claude Code on behalf of davsclaus_ [CAMEL-25237](https://issues.apache.org/jira/browse/CAMEL-25237) **Problem:** the send of each Switch case is instrumented and registered as a processor MBean with the case's id (`case1`, …), but tooling could not find it. - `camel get processor`, the route structure statistics and the dev consoles list `switch1` and `switch1-otherwise`, never the cases. - So the messages that went to the cases could not be told apart. **Cause:** these tools look a processor up by its id: `ManagedCamelContext.getManagedProcessor(id)` calls `Model.getProcessorDefinition(id)`. - That lookup walks the processor children of the routes. A case is a `SwitchCaseDefinition` (not a processor definition), and the `ToDefinition` of its send, which carries the case's id, is not among the children, so the lookup returns null. - The otherwise works because `SwitchDefinition.getChildren()` lists its send `ToDefinition` directly. **Fix:** `DefaultModel.getProcessorDefinition(id)` also matches the sends of a Switch's cases. A case's send is then found by the case's id, including with a node prefix id. The cases are deliberately not exposed as children. That would add an extra `to` node under every case in the route structure dumps and diagrams. **Verified:** - With `camel run` (semantic agent routing demo: a Switch of 4 cases and an otherwise), `camel get processor` now lists `case1`…`case4` with their own counts. The cases and the otherwise add up to the switch's total. - The camel-jbang route diagram shows the count per row (apache/camel#27228). **Tests:** - `ManagedSwitchTest.countsEveryCaseWithAGeneratedId`: a Switch whose cases have generated ids, as YAML routes write it. Each case is counted, listed by its route, and found by `getManagedProcessor(id)`; that last check failed before the fix. - `SwitchTest.theSendOfACaseIsFoundByTheIdOfTheCase`. - camel-management (527) and the Switch tests of camel-core pass. The Switch EIP is new in 4.23, so no upgrade note is needed. 🤖 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]
