[ 
https://issues.apache.org/jira/browse/CAMEL-26673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-26673.
---------------------------------
    Resolution: Fixed

Merged: https://github.com/apache/camel/pull/29315 (main)

_Claude Code on behalf of davsclaus_

> camel-jbang - camel run and camel export ask the Quarkus Extension Registry 
> for runtimes that do not use Quarkus, and stop when it cannot be reached
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26673
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26673
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>    Affects Versions: 4.23.0
>            Reporter: Serdar Gökay
>            Assignee: Serdar Gökay
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Since 4.21.0 (CAMEL-23560) the Camel CLI finds the Quarkus Platform by asking 
> the Quarkus Extension Registry. {{camel run}} and {{camel export}} ask also 
> when the runtime is not Quarkus, as one of their first steps, and the command 
> stops when the registry cannot be reached. On a machine that cannot reach 
> registry.quarkus.io, an integration that uses nothing from Quarkus then does 
> not start, and a Camel Main or Spring Boot project is not exported.
> h3. Observed
> Camel CLI 4.23.0 and 4.24.0-SNAPSHOT (nightly 20261105.143830), Java 25. The 
> registry is replaced by a closed local port for which no cached answer 
> exists, so the cache under {{~/.camel/quarkus-extension-registries}} plays no 
> part.
> ||Command||4.23.0||main||
> |camel run, default runtime (in process)|stops, no route is loaded|stops, no 
> route is loaded|
> |camel run, runtime camel-main|starts|stops|
> |camel export, runtime camel-main|stops, no project is written|stops, no 
> project is written|
> |camel export, runtime spring-boot|stops, no project is written|stops, no 
> project is written|
> |camel run, default runtime, with a Quarkus version given|starts|starts|
> |camel export, runtime camel-main, with a Quarkus version given|project is 
> written|project is written|
> h3. Reproduce
> hello.yaml:
> {noformat}
> - route:
>     id: hello
>     from:
>       uri: timer:tick
>       parameters:
>         period: 1000
>       steps:
>         - log: "ROUTE-RUNNING"
> {noformat}
> {noformat}
> camel run hello.yaml --quarkus-ext-registry=http://127.0.0.1:9
> camel run hello.yaml --runtime=camel-main 
> --quarkus-ext-registry=http://127.0.0.1:9
> camel export hello.yaml --runtime=camel-main --gav=com.example:demo:1.0 
> --dir=out --quarkus-ext-registry=http://127.0.0.1:9
> camel export hello.yaml --runtime=spring-boot --gav=com.example:demo:1.0 
> --dir=out --quarkus-ext-registry=http://127.0.0.1:9
> {noformat}
> The first command on 4.23.0:
> {noformat}
> java.lang.RuntimeException: Could not fetch from 
> http://127.0.0.1:9/client/platforms/all
>       at 
> org.apache.camel.dsl.jbang.core.common.QuarkusHelper.fetchPlatformStreams(QuarkusHelper.java:369)
>       at 
> org.apache.camel.dsl.jbang.core.common.QuarkusHelper.findQuarkusPlatformBom(QuarkusHelper.java:196)
>       at 
> org.apache.camel.dsl.jbang.core.common.QuarkusHelper.findQuarkusPlatformBom(QuarkusHelper.java:159)
>       at 
> org.apache.camel.dsl.jbang.core.commands.QuarkusPlatformMixin.resolve(QuarkusPlatformMixin.java:76)
>       at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:987)
> {noformat}
> The Spring Boot export on 4.23.0:
> {noformat}
> Generating fresh run data
> java.lang.RuntimeException: Could not fetch from 
> http://127.0.0.1:9/client/platforms/all
>       at 
> org.apache.camel.dsl.jbang.core.common.QuarkusHelper.fetchPlatformStreams(QuarkusHelper.java:369)
>       at 
> org.apache.camel.dsl.jbang.core.common.QuarkusHelper.findQuarkusPlatformBom(QuarkusHelper.java:196)
>       at 
> org.apache.camel.dsl.jbang.core.common.QuarkusHelper.findQuarkusPlatformBom(QuarkusHelper.java:159)
>       at 
> org.apache.camel.dsl.jbang.core.commands.QuarkusPlatformMixin.resolve(QuarkusPlatformMixin.java:76)
>       at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:987)
>       at org.apache.camel.dsl.jbang.core.commands.Run.runExport(Run.java:632)
>       at 
> org.apache.camel.dsl.jbang.core.commands.ExportBaseCommand.runSilently(ExportBaseCommand.java:615)
>       at 
> org.apache.camel.dsl.jbang.core.commands.ExportSpringBoot.export(ExportSpringBoot.java:87)
> {noformat}
> h3. What the answer is used for
> With a runtime other than Quarkus the resolved version goes to two places: 
> the run settings ({{camel.jbang.quarkusVersion}}, with the group id and the 
> registry URI), and {{KnownDependenciesResolver}}, which puts it into the 12 
> entries of {{camel-main-known-dependencies.properties}} that end in the 
> quarkus-version placeholder, for example:
> {noformat}
> quarkus.datasource.db-kind\=postgresql = 
> io.quarkus:quarkus-jdbc-postgresql:${quarkus-version}
> jakarta.inject.Inject = io.quarkus:quarkus-core:${quarkus-version}
> {noformat}
> A route that needs none of these entries does not use the answer.
> h3. Earlier behaviour and discussion
> * In 4.18.5 {{QuarkusHelper.fetchPlatformStreams}} returns null when the 
> registry does not answer within 2 seconds, and its callers fall back to the 
> build-time version.
> * CAMEL-23560 removed the build-time version, and the fallback went with it. 
> The Javadoc of {{fetchPlatformStreams}} still says that null is returned when 
> the registry is unreachable.
> * Users without internet access came up on CAMEL-23353 and again in the 
> review of [PR #23333|https://github.com/apache/camel/pull/23333]. In that 
> review a given Quarkus version and the local cache were named as the way for 
> such environments. As I read them, both discussions were about commands that 
> need a Quarkus Platform version. The 4.21 and 4.23 upgrade guides and 
> CAMEL-24761 describe the lookup for those commands too. I did not find a 
> place in JIRA or the pull requests that says the other runtimes should depend 
> on the registry.
> h3. On main
> On 4.23.0 {{camel run}} with the camel-main runtime did not ask: 
> {{Run.runCamelMain}} created the exporter without a Quarkus platform, so the 
> silent run skipped the lookup. On main the export request always has one 
> ({{ExportRequest.quarkusPlatform}} is initialised, and 
> {{SilentRunDependencyResolver}} passes it to the run request), so this 
> command now stops too:
> {noformat}
> Running using Camel Main (preparing and downloading files)
> ERROR: Could not fetch from http://127.0.0.1:9/client/platforms/all
> java.lang.RuntimeException: Could not fetch from 
> http://127.0.0.1:9/client/platforms/all
>       at 
> org.apache.camel.dsl.jbang.run.common.QuarkusHelper.fetchPlatformStreams(QuarkusHelper.java:370)
>       at 
> org.apache.camel.dsl.jbang.run.common.QuarkusHelper.findQuarkusPlatformBom(QuarkusHelper.java:197)
>       at 
> org.apache.camel.dsl.jbang.run.common.QuarkusHelper.findQuarkusPlatformBom(QuarkusHelper.java:160)
>       at 
> org.apache.camel.dsl.jbang.run.common.QuarkusPlatform.resolve(QuarkusPlatform.java:79)
>       at 
> org.apache.camel.dsl.jbang.run.RunPipeline.configure(RunPipeline.java:486)
>       at 
> org.apache.camel.dsl.jbang.run.SilentRunDependencyResolver.resolve(SilentRunDependencyResolver.java:86)
>       at 
> org.apache.camel.dsl.jbang.run.export.Exporter.runSilently(Exporter.java:223)
>       at 
> org.apache.camel.dsl.jbang.run.export.CamelMainExporter.export(CamelMainExporter.java:81)
>       at 
> org.apache.camel.dsl.jbang.run.export.ProjectExporter.export(ProjectExporter.java:187)
>       at 
> org.apache.camel.dsl.jbang.run.CamelMainRunner.start(CamelMainRunner.java:125)
>       at 
> org.apache.camel.dsl.jbang.run.ProjectRunner.start(ProjectRunner.java:80)
>       at 
> org.apache.camel.dsl.jbang.core.commands.Run.runWithMaven(Run.java:917)
>       at 
> org.apache.camel.dsl.jbang.core.commands.Run.runCamelMain(Run.java:908)
> {noformat}
> h3. Proposed change
> Make the command independent of the registry for runtimes other than Quarkus. 
> Two ways I can see:
> # resolve the platform only when a dependency with the quarkus-version 
> placeholder is needed, or
> # keep the lookup, and when it fails log it and continue without a Quarkus 
> version, so that only a dependency that needs the version fails.
> Nothing changes for the Quarkus runtime. I can prepare a pull request; please 
> say which way you prefer.
> h3. Workaround
> Give the Quarkus version. With the quarkus-version option the registry is not 
> asked (4.23.0 and main); {{camel.jbang.quarkusVersion}} in 
> application.properties does the same (checked on 4.23.0).
> {noformat}
> camel run hello.yaml --quarkus-version=3.40.1.1 
> --quarkus-ext-registry=http://127.0.0.1:9
> {noformat}
> Filed as Bug because of the change on main for the camel-main runtime. The 
> part that exists since 4.21.0 may fit Improvement better; please reclassify 
> as you see fit.
> _Claude Code on behalf of etzel-mes_



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

Reply via email to