Claus Ibsen created CAMEL-24849:
-----------------------------------

             Summary: Make camel-http the default REST producer client 
(rest-openapi, rest producer) instead of vertx-http, in the rest component's 
default list and in the Camel CLI's dependency rule
                 Key: CAMEL-24849
                 URL: https://issues.apache.org/jira/browse/CAMEL-24849
             Project: Camel
          Issue Type: Improvement
          Components: rest, camel-jbang, camel-rest-openapi
            Reporter: Claus Ibsen


When a REST producer (a {{rest:}} producer endpoint, or {{rest-openapi}} 
calling an operation of a contract) has no {{componentName}} / 
{{producerComponentName}}, the client component is picked in this order:

# a component already in the context that implements RestProducerFactory;
# the registry;
# {{RestEndpoint.DEFAULT_REST_PRODUCER_COMPONENTS}}: {{vertx-http}}, {{http}}, 
{{undertow}}, {{netty-http}}.

And the Camel CLI's dependency rule for {{rest-openapi}} 
(DependencyDownloaderComponentResolver) downloads {{camel-vertx-http}} as the 
producer component, which makes vertx-http the de-facto default under {{camel 
run}} even when nothing else asked for Vert.x.

vertx-http as the default is the odd choice today: Vert.x is the Quarkus stack, 
most Camel users run Spring Boot, and camel-http is the reference HTTP client 
that carries the name. With platform-http native on Spring Boot as well, a 
Spring Boot user who adds both starters gets Vert.x as the client without 
having chosen it.

Proposal, two small changes and an upgrade-guide note:

* {{RestEndpoint.DEFAULT_REST_PRODUCER_COMPONENTS}} = {{http}}, {{vertx-http}}, 
{{undertow}}, {{netty-http}}: camel-http first.
* The CLI rule for {{rest-openapi}} downloads {{camel-http}} instead of 
{{camel-vertx-http}}.

What does not change: a project with only one RestProducerFactory on the 
classpath keeps it (a Quarkus app with camel-quarkus-vertx-http alone still 
uses vertx-http); a {{componentName}} still wins; the rest-openapi 
documentation's list of supported clients stays. Only the tie-break when both 
are present, and what the CLI pulls in, change.

Related: CAMEL-24822 (vertx-http created its Vert.x in doStart only, so a 
late-resolved component failed with an NPE; fixed independently of the default 
in PR 26624). Found while the round-2 local-model benchmark hit the NPE on the 
openapi-client example of camel-jbang-examples.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to