routesapache-camelquarkusendpointeai

How to write a Camel Quarkus extension for a Camel component/endpoint?


I have an own camel component/endpoint that I used successfully in many routes in a Spring Boot App. I am trying to migrate to camel quarkus and use the same routes in my application.

It's not possible to use this component/endpoint in my camel-quarkus aplication by simply adding the related dependency: quarkus is not able to discover this component/endpoint as does Spring Boot.

The obvious solution is to write a quarkus extension that uses this camel-component under the hood: quarkus extensions like jdbc, file, sql and so on are implemented using the corresponding camel-components.

If we take a look into the pom-xml of sql of its runtime module, we find that it's using the equivalent camel-sql component:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-sql</artifactId>
</dependency>

My problem is that quarkus still not discover the component/endpoint even if building by project (I am using eclipse), quarkus shows that it has installed my extension. I searched for a long time in the internet but didn't find any helpfull source.


Solution

  • The obvious solution is not to write an extra extension. The Quarkus-Runtime discovers the classes in a module or a third-party dependency if and only if:

    1. the third-party dependency is indexed in the host-project: By adding the following entries to the .properties file:

    quarkus.index-dependency..group-id=<group-id>
    quarkus.index-dependency..artifact-id=<artifact-id>

    or .yaml file:

    quarkus:  
       index-dependency:
         <name>:
            group-id: <group-id>
            artifact-id: <artifact-id> 
    

    where <group-id> and <artifact-id> are third-party ones.

    1. The jandex-maven-plugin is present in the pom.xml of this module or third-party dependency
    2. An empty beans.xml is present under src/main/resorces/META-INF of this module/dependency

    I find the answer to my question in this post.