[
https://issues.apache.org/jira/browse/CAMEL-25237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121626#comment-18121626
]
Claus Ibsen commented on CAMEL-25237:
-------------------------------------
PR: https://github.com/apache/camel/pull/27229
The case sends were counted all along, as MBeans with the case ids, but
Model.getProcessorDefinition(id) could not find them, so camel get processor
and the route structure left them out. Fixed in DefaultModel.
_Claude Code on behalf of davsclaus_
> camel-core - Switch EIP should count the messages per case
> ----------------------------------------------------------
>
> Key: CAMEL-25237
> URL: https://issues.apache.org/jira/browse/CAMEL-25237
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> The Switch EIP (CAMEL-24988) is a decision table: a selector, then {{value ->
> uri}} cases and an otherwise. At runtime only the switch itself and its
> otherwise are managed processors with statistics. The cases have none, so
> there is no way to see how many messages each case received.
> *Reproduce*
> {code:yaml}
> - route:
> id: specialist-dispatch
> from:
> uri: direct:dispatch
> steps:
> - switch:
> selector:
> exchangeProperty:
> expression: specialist
> case:
> - value: reservation
> uri: "a2a:{{agents.reservation.url}}"
> - value: weather
> uri: "a2a:{{agents.weather.url}}"
> otherwise:
> uri: direct:unsupported-specialist
> {code}
> Send some messages, then run {{camel get processor}}: it lists {{switch1}}
> (109 messages) and {{switch1-otherwise}} (22), but no {{case1}}, {{case2}},
> ... The route structure dump ({{camel cmd route-structure --json}}) has
> statistics for {{switch1}} and {{switch1-otherwise}}, and none for the
> {{case}} nodes. So the 87 messages that went to the cases cannot be told
> apart.
> *Where*
> {{JmxManagementLifecycleStrategy.registerPerformanceCounters}} already
> prepares the case sends ({{SwitchCaseDefinition.prepareToDefinition()}}) and
> registers counters for them, as it does for the otherwise. Yet no managed
> processor ends up registered for a case. A likely cause is the ids:
> * The otherwise send takes its id from the switch ({{switch1-otherwise}}),
> which already has one when management runs.
> * A case gets its id later, in {{SwitchReifier}} ({{c.idOrCreate(ids)}}),
> after management has prepared its send without one.
> This needs to be confirmed.
> *Expected*
> Each case send is a managed processor with the case's id ({{case1}}, ... or a
> custom id), like the otherwise. Then:
> * {{camel get processor}} lists every case;
> * the route structure has statistics for each case node;
> * the JMX MBeans and the dev consoles count each case;
> * the counts of the cases and the otherwise add up to the switch's total.
> The route diagram in camel-jbang draws a Switch as a decision table with a
> count per row and shows it as soon as the cases have statistics
> (apache/camel#27228).
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)