Claus Ibsen created CAMEL-27717:
-----------------------------------

             Summary: camel-rest-postman: WARN per existing component, shared 
custom strategy, labels, default
                 Key: CAMEL-27717
                 URL: https://issues.apache.org/jira/browse/CAMEL-27717
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


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

h4. 1. Producer logs a WARN for every component already in the Camel context
{{RestPostmanEndpoint.determineEndpointParameters()}} always puts 
{{useGlobalSslContextParameters}} (also when it is {{false}}) into the nested 
{{component}} options of the delegate {{rest}} endpoint, so that map is never 
empty.
{{RestEndpoint.findFromExistingComponents()}} then calls 
{{RestProducerFactoryHelper.setupComponent()}} for every component in the 
context, and for each one that already exists it logs at WARN "Found existing 
... component already present in the Camel context. Not setting component 
properties ...". With {{componentName}} set, the same WARN comes for an 
existing delegate component.
The user sees one WARN per component (for example direct, log, rest, 
rest-postman) each time a rest-postman producer is created, without having 
configured any TLS option.
Proposed change: add {{useGlobalSslContextParameters}} only when it is 
{{true}}, and {{sslContextParameters}} only when set, as 
{{RestOpenApiEndpoint}} does.

h4. 2. A custom restPostmanProcessorStrategy is shared and changed by every 
consumer endpoint
{{RestPostmanComponent.createProcessorStrategy()}} returns the one configured 
instance to every endpoint, and {{RestPostmanEndpoint.createConsumer()}} calls 
{{setMissingRequest()}} (when set) and {{setMockIncludePattern()}} (always, as 
it has a default) on it. With several rest-postman consumers, the options of 
the endpoint created last apply to all of them.
Each {{RestPostmanProcessor}} also inits, starts and stops that same instance 
({{afterPropertiesConfigured()}}, {{doStop()}}), so stopping one consumer route 
stops the strategy that the other consumers still use.
Proposed change: pass the endpoint options per call (or create a copy per 
endpoint), and do not let one processor stop a strategy that the component owns.

h4. 3. Labels do not match the side that uses the option
* {{requestId}} (path) is labelled {{producer}}, but 
{{RestPostmanEndpoint.createConsumer()}} also resolves it, so a consumer serves 
only the selected request or folder.
* {{requestFilter}} is labelled {{consumer,advanced}}, but the producer applies 
it too ({{RestPostmanEndpoint.buildIndex()}}).
* {{consumes}} and {{produces}} are labelled {{producer,advanced}}, but they 
also set the media types of the consumer binding 
({{RestPostmanProcessor.createRestBindingConfiguration()}} uses 
{{binding.produces()}} as the accepted Content-Type).
Proposed change: label them {{common}} (or {{common,advanced}}).

h4. 4. missingRequest default is fail in the metadata, but mock in the dev 
profile
The field {{RestPostmanConfiguration.missingRequest}} has no value, and 
{{DefaultRestPostmanProcessorStrategy.doInit()}} picks {{mock}} when the Camel 
profile is {{dev}} and {{fail}} otherwise. The metadata only says 
{{defaultValue = "fail"}}.
Proposed change: add a {{defaultValueNote}} that names the dev profile default.

_Claude Code on behalf of davsclaus_



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

Reply via email to