davsclaus opened a new pull request, #31050: URL: https://github.com/apache/camel/pull/31050
JIRA: [CAMEL-27725](https://issues.apache.org/jira/browse/CAMEL-27725), all five items, plus two bugs found in the same code. **1. Consumers on the same host and port share the server of the first consumer.** `AvroListener` now remembers the transport, protocol and `reflectionProtocol` it was created with. A consumer that joins with another value fails to start with an `AvroComponentException`, for example: "Consumer http:localhost:9000/put cannot share the Avro server on localhost:9000 with netty:localhost:9000: the transport http differs from netty. ...". Before, such a consumer was registered and then served with the wrong protocol or responder type, or by a server of the other transport. **2. `protocolLocation` did nothing.** It now loads the protocol from an Avro protocol file in JSON (`.avpr`) with `ResourceHelper` (so `classpath:`, `file:` and the other resource schemes work) and `Protocol.parse()`. The order is `protocol`, then `protocolClassName`, then `protocolLocation`, so an endpoint that sets `protocolClassName` keeps working as before. The protocol goes through the same class-trust step as the other two options. **3. `uriAuthority`** is deprecated (not removed, so URIs that set it still start). It never had an effect. The listeners are now keyed by the host and port of the endpoint, which is what the authority was. **4. `exchangePattern` on the consumer:** the doc page now says that the pattern follows the called message (`InOnly` for a `null` response, else `InOut`), and that the option has no effect on the consumer. **5. `singleParameter`** has the `consumer` label. **Also fixed:** - A consumer that failed to register (for example a second default consumer on the same host and port, written as `netty://localhost:...`) unregistered the working consumer when it was stopped, so that consumer answered "No consumer defined for message". `AvroConsumer` now unregisters only when it registered, and `AvroListener.unregister()` removes only the consumer itself. `AvroComponent.unregister()` no longer throws a `NullPointerException` for a missing listener. - `AvroComponent.register()` and `unregister()` are `synchronized`, so two consumers that start at the same time cannot create two servers. **Tests:** - New `AvroConsumerSharedServerTest`: - A second default consumer, another transport, another protocol and another `reflectionProtocol` each fail to start, and the first consumer still answers after each one. - `protocolLocation` works for a consumer and a producer, and a missing file names the file in the error. - Without the fix, the first `assertServes()` already fails with "No consumer defined". - The cases share two test methods, because Avro's Netty server takes about 4 seconds to close. - `AvroNettyConsumerTest` had two `avro:http` consumers on its netty port, called by a netty requestor. They only worked because of item 1, and they are `avro:netty` now. - All 72 tests of the module pass. Docs: the doc page explains the shared server and the three protocol options. The upgrade guide has an entry for the consumers that now fail, `protocolLocation` and the deprecation. Regenerated the component JSON, the catalog copies and the endpoint/component DSL. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
