davsclaus opened a new pull request, #27736: URL: https://github.com/apache/camel/pull/27736
`MetadataHelper.readFromSource` (used by `camel kubernetes export/run`) read every route source by building and starting a stubbed CamelContext. On every call that meant: - resolving the Quarkus platform BOM through the Maven downloader and the Quarkus extension registry; - setting up a downloading class loader, class resolver and routes loader; - for a Java source, compiling it and running `configure()`. Of all it collected, only the endpoint uris are used: - the **service trait** creates a Kubernetes Service when a route consumes from an http component or knative; - the **knative trait** configures the `knative:` channels, endpoints and events. The components, languages, data formats, kamelets, capabilities and Maven dependencies were never read outside the helper's own test. ## What this does - **Java and XML sources** are read into the route model without starting anything, using `RouteModel`/`RouteNodes` of camel-jbang-core. Java goes through the Java DSL parser, so the source is neither compiled nor run, and there is no network lookup. `from` is the route inputs; `to` is the fixed endpoints the routes send to (`to`, and `wireTap` without an expression), minus the inputs, as before. A value only known at runtime is left out. A Java or XML file that is not a route source has no endpoints. - **YAML sources** (routes, Pipes, Kamelets) keep the stubbed CamelContext. The YAML DSL builds the uri of an endpoint written with parameters from the component (which the downloader brings in), and a Pipe's source and sink become uris in its loader. The Quarkus platform lookup of that context is now done once instead of on every call. - The unused metadata is removed, together with the `Capability` enum and the dead customizers. The Java and XML uris are as the route has them (`platform-http:/hello?...`) instead of normalized (`platform-http:///hello?...`). The knative uri pattern and `catalog.endpointComponentName` read both forms. ## Tests - `MetadataHelperTest`: a Java route that does not compile (`new NoSuchProcessor()`) with knative channel, event and endpoint uris, where the `toD` with an expression is left out; an XML route; a Java file that is no route; and the existing Java and YAML cases. - `KubernetesExportTest.shouldAddServiceForJavaRoute`: exporting a Java `platform-http` route creates the Service, for main, Spring Boot and Quarkus. - All 153 tests of the plugin pass. Fixes [CAMEL-25592](https://issues.apache.org/jira/browse/CAMEL-25592) _Claude Code on behalf of Claus Ibsen_ 🤖 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]
