[
https://issues.apache.org/jira/browse/CAMEL-27620?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27620:
--------------------------------
Fix Version/s: 4.24.0
(was: 4.25.0)
> camel-browse: filter also hides messages from the consumer; browse keeps live
> exchanges
> ---------------------------------------------------------------------------------------
>
> Key: CAMEL-27620
> URL: https://issues.apache.org/jira/browse/CAMEL-27620
> Project: Camel
> Issue Type: Bug
> Reporter: Claus Ibsen
> Assignee: shashank
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while improving the option descriptions of camel-browse for CAMEL-23832
> (PR https://github.com/apache/camel/pull/30958).
> These are separate problems of the component; the descriptions PR only
> documents the current behavior.
> h4. 1. The filter option also stops the exchange from reaching the consumer
> The {{filter}} option is meant to choose which messages are kept for
> browsing. But the producer that {{BrowseEndpoint.createProducer()}} creates
> tests the filter before it calls {{onExchange(exchange)}}. {{onExchange}}
> does two things: it adds the exchange to the browse list, and it calls the
> processor of the consumer. So when the filter returns false, the route that
> consumes from the same endpoint ({{from("browse:name?filter=#myFilter")}})
> never gets the exchange.
> {code:java}
> boolean accept = true;
> if (filter != null) {
> accept = filter.test(exchange);
> }
> if (accept) {
> onExchange(exchange); // stores the exchange AND fires the consumer
> }
> {code}
> The user sees messages go missing in the consumer route as soon as a filter
> is set, with nothing logged.
> Proposed change: apply the filter only to adding the exchange to the list,
> and always pass the exchange to the consumer. If the current behavior is
> intended, the option docs should say that the filter also filters the
> consumer.
> h4. 2. The doc page does not say that browsed exchanges are live references
> {{BrowseEndpoint.onExchange()}} stores the exchange object itself, not a
> copy. The rest of the route goes on with the same exchange, so later steps
> (and the consumer route) that change the message also change what is browsed
> afterwards, for example in the dev console or in {{getExchanges()}} in a test.
> Proposed change: say this on the doc page of the component (no code change),
> or store a copy if browsing should show the message as it was when it reached
> the endpoint.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)