Claus Ibsen created CAMEL-27725:
-----------------------------------

             Summary: camel-avro-rpc: shared server ignores later protocols, 
unused protocolLocation and uriAuthority
                 Key: CAMEL-27725
                 URL: https://issues.apache.org/jira/browse/CAMEL-27725
             Project: Camel
          Issue Type: Bug
          Components: camel-avro-rpc
            Reporter: Claus Ibsen
             Fix For: 4.24.0


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

h4. 1. Consumers on the same host and port share the server of the first 
consumer
{{AvroComponent.register()}} keys the listeners by {{uriAuthority}} (host and 
port) and creates the {{AvroListener}} only for the first consumer that starts. 
{{AvroListener.initAndStartServer()}} builds the responder from that first 
consumer's {{protocol}} and {{reflectionProtocol}}. A second consumer on the 
same host and port with another protocol, or with another 
{{reflectionProtocol}} value, is registered, but the server does not know its 
messages or uses the wrong responder type.
Proposed change: fail at startup when a consumer joins a listener whose 
protocol or {{reflectionProtocol}} differs, or keep one server per protocol.

h4. 2. The option protocolLocation does nothing
{{AvroConfiguration}} has the {{protocolLocation}} field with a getter and 
setter, but no code reads it. {{AvroEndpoint.validateConfiguration()}} only 
uses {{protocol}} and {{protocolClassName}}. A user who sets 
{{protocolLocation}} gets the error "Avro configuration does not contain 
protocol".
Proposed change: load the protocol from the location (for example an {{.avpr}} 
file with {{Protocol.parse()}}), or deprecate and remove the option.

h4. 3. uriAuthority set on the component is always replaced
{{AvroComponent.createEndpoint()}} copies the component configuration and then 
calls {{AvroConfiguration.parseURI()}}, which always calls 
{{setUriAuthority(uri.getAuthority())}}. A value set on the component has no 
effect. The value is internal state (the key of the listener registry) rather 
than a user option.
Proposed change: make {{uriAuthority}} an internal field instead of an endpoint 
and component option.

h4. 4. exchangePattern has no effect on the consumer
{{AvroListener.createExchange()}} always sets the exchange pattern from the 
message: {{InOnly}} when the response type is null, else {{InOut}}. The 
{{exchangePattern}} endpoint option is overwritten.
Proposed change: document that the pattern follows the protocol message, or 
hide the option for this consumer.

h4. 5. singleParameter has no label
{{singleParameter}} changes only the consumer body 
({{AvroListener.extractParams()}}); the producer always wraps a body that is 
not an {{Object[]}} into an array ({{AvroProducer.wrapObjectToArray()}}). The 
option has no {{consumer}} label, and no option of the component has a consumer 
or producer label.
Proposed change: add {{label = "consumer"}} to {{singleParameter}} in 
{{AvroConfiguration}}.

_Claude Code on behalf of davsclaus_



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

Reply via email to