Tonatiuh011 opened a new issue, #6502:
URL: https://github.com/apache/camel-k/issues/6502

   ### Requirement
   
   Hi,
   
   Topic from Zulip: [#camel-k > Auto-discover/load RouteBuilder from Maven 
dependency 
(Jar)](https://camel.zulipchat.com/#narrow/channel/257299-camel-k/topic/Auto-discover.2Fload.20RouteBuilder.20from.20Maven.20dependency.20.28Jar.29/with/574670586)
   
   I have some Java Camel routes packaged in a Maven artifact that I would like 
to run in my integrations.
   
   **Specs:**
   * Camel K: 2.9.0
     
   * Repository: Nexus (private maven repo)
     
   **Current Workaround:** To start the routes, I have to use an additional 
"loader" Java class to manually wire them:
   
   ```java
   import org.apache.camel.builder.RouteBuilder;
   import org.tnt.camel.MyRouteBuilder;
   
   public class Loader extends RouteBuilder {
     @Override
     public void configure() throws Exception {
         getContext().addRoutes(new MyRouteBuilder());
     }
   }
   ```
   
   The Java route inside my Maven artifact looks like this:
   ```java
   package org.tnt.camel;
   
   import org.apache.camel.builder.RouteBuilder;
   
   public class MyRouteBuilder extends RouteBuilder {
       public void configure() {
           from("timer:test")
                   .setBody().constant("Hi from jar!")
                   .log("${body}");
       }
   }
   ```
   
   I run this integration using the following command:
   ```bash
   kamel run Loader.java test.camel.yaml --name test-mvn -d 
mvn:org.tnt.camel:tnt-camel:1.0.0
   ```
   **The Question:** All works good, but I was wondering if there is an 
alternative way to tell Camel K to **auto-discover** or scan for routes in the 
classpath at runtime?
   
   I am looking for something similar to `camel.main.routes-include-pattern` so 
I can just point to the JAR and avoid writing the `Loader.java` wrapper class.


-- 
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]

Reply via email to