Claus Ibsen created CAMEL-27706:
-----------------------------------

             Summary: camel-amqp: includeAmqpAnnotations cast error and 
endpoint metadata, labels, defaults
                 Key: CAMEL-27706
                 URL: https://issues.apache.org/jira/browse/CAMEL-27706
             Project: Camel
          Issue Type: Bug
          Components: camel-amqp
            Reporter: Claus Ibsen
             Fix For: 4.24.0


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

h4. 1. includeAmqpAnnotations on an endpoint URI fails with a 
ClassCastException for a plain JmsConfiguration
{{AMQPComponent.setProperties()}} casts the endpoint configuration to 
{{AMQPConfiguration}}. A component created with {{new AMQPComponent(new 
JmsConfiguration(cf))}} gives its endpoints a plain {{JmsConfiguration}}, so 
{{amqp:queue:foo?includeAmqpAnnotations=true}} fails with a 
{{ClassCastException}}. On the same component, 
{{AMQPComponent.setIncludeAmqpAnnotations()}} is silently ignored.
Proposed change: check the type as the component setter does, and fail with a 
clear message (or wrap the configuration) instead of a cast error.

h4. 2. includeAmqpAnnotations is missing from the endpoint metadata
{{JmsEndpoint}} declares its configuration as {{@UriParam JmsConfiguration 
configuration}}, so the {{@UriParam}} field {{includeAmqpAnnotations}} of 
{{AMQPConfiguration}} is not scanned. {{AMQPComponent.setProperties()}} still 
reads the option from the endpoint URI, but it is not in the endpoint options 
of {{amqp.json}}, {{AMQPEndpointConfigurer}}, {{AMQPEndpointUriFactory}} or the 
Endpoint DSL, so the docs do not list it and the catalog validation reports it 
as unknown.
Proposed change: make the option part of the endpoint metadata of amqp, for 
example with a {{@UriParam}} on {{AMQPEndpoint}}.

h4. 3. includeAmqpAnnotations component option has no label
The component option ({{@Metadata}} on 
{{AMQPComponent.setIncludeAmqpAnnotations()}}) has no label and lands in group 
common. The {{AMQPConfiguration}} field has {{consumer,advanced}}.
Proposed change: add {{label = "consumer,advanced"}} to the component 
{{@Metadata}}.

h4. 4. host, port and useTopicPrefix have no defaultValue
{{AMQPComponent.doInit()}} uses {{localhost}}, {{5672}} and the {{topic://}} 
prefix when these options are not set, but the metadata declares no 
{{defaultValue}}. The fields are null on purpose, as a set value makes the 
component build its connection factory.
Proposed change: add {{defaultValue}} to the {{@Metadata}} of the three 
options, keeping the fields null.

h4. 5. TLS options have no security label
{{useSsl}}, {{keyStoreLocation}}, {{keyStoreType}}, {{trustStoreLocation}} and 
{{trustStoreType}} have no label, while {{keyStorePassword}} and 
{{trustStorePassword}} have {{security}}.
Proposed change: add {{label = "security"}} to these options.

h4. 6. Shared camel-jms text of connectionFactory does not fit amqp
The {{connectionFactory}} text of camel-jms says "The connection factory to be 
use. A connection factory must be configured either on the component or 
endpoint." For amqp the component creates one from {{brokerUrl}} or {{host}} 
and {{port}}. The text also has the typo "to be use".
Proposed change: fix the typo in camel-jms and say that a component may create 
the connection factory itself.

_Claude Code on behalf of davsclaus_



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

Reply via email to