Claus Ibsen created CAMEL-27742:
-----------------------------------

             Summary: camel-stub: most endpoint options ignored on stub: URIs, 
shadowPattern has no list syntax
                 Key: CAMEL-27742
                 URL: https://issues.apache.org/jira/browse/CAMEL-27742
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-stub for CAMEL-23832 
(commit 
https://github.com/apache/camel/commit/b82eef5b59e581059179cfd3aa240e1194ec9c8c).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. Most endpoint options in a stub: URI are silently ignored
{{StubComponent.setProperties(Endpoint, Map)}} is empty, so 
{{DefaultComponent.createEndpoint()}} never applies the remaining query 
parameters to the {{StubEndpoint}}.
Only the options that {{SedaComponent.createEndpoint(String, String, Map)}} 
reads itself with {{getAndRemoveParameter}} apply ({{size}}, 
{{concurrentConsumers}}, {{limitConcurrentConsumers}}, {{queue}}, 
{{blockWhenFull}}, {{discardWhenFull}}, {{offerTimeout}}, {{pollTimeout}}), 
plus {{bridgeErrorHandler}}, {{lazyStartProducer}} and {{autowiredEnabled}}.
{{waitForTaskToComplete}}, {{timeout}}, {{failIfNoConsumers}}, 
{{discardIfNoConsumers}}, {{multipleConsumers}}, {{purgeWhenStopping}}, 
{{virtualThreadPerTask}}, {{browseLimit}}, {{exceptionHandler}} and 
{{exchangePattern}} are listed in the stub metadata and the Endpoint DSL, but 
have no effect when set on a stub: URI (the endpoint is lenient, so there is no 
error either).
For example {{StubProducer.addToQueue()}} checks {{isFailIfNoConsumers()}} and 
{{isDiscardIfNoConsumers()}}, which can only be true when set from Java.
Proposed change: apply the known seda options and ignore only the unknown 
parameters of the stubbed URI, or document in the stub page which options apply.

h4. 2. shadowPattern has no list syntax, but the Camel CLI passes component 
names to it
{{StubComponent.doInit()}} matches {{shadowPattern}} with 
{{EndpointHelper.matchEndpoint()}} against the whole endpoint URI including the 
stub: prefix: one exact URI, a wildcard with a trailing {{*}}, or a regular 
expression that must match the whole URI. A comma-separated list is not split.
{{DependencyDownloaderComponentResolver.resolveComponent()}} sets the value of 
{{camel run --stub}} as {{shadowPattern}}, and that value is a list of 
component names or patterns separated by comma (its own {{accept()}} splits it 
on comma and strips a {{component:}} prefix). Such a value, for example 
{{kafka}}, {{kafka,jms}} or {{component:remote}}, never matches 
{{stub:kafka:foo}}, so no shadow endpoint is registered for a stub: endpoint in 
the route. The old option text also said that several patterns can be separated 
by comma.
Proposed change: split {{shadowPattern}} on comma, and match a plain name 
against the component of the stubbed URI (or do not pass the {{--stub}} value 
as {{shadowPattern}}).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to