Uploaded image for project: 'Red Hat Build of Apache Camel for Quarkus'
  1. Red Hat Build of Apache Camel for Quarkus
  2. CEQ-1825

Camel-K ElasticsearchComponent options ignored

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • Camel Quarkus, Camel-K
    • None
    • False
    • False
    • Undefined
    • 0

      When I try to configure the elasticsearch component for camel-k integration, I did the same as mentioned in camel documentation as there is nothing specific in camel-quarkus documentation.

      So I do something like:

      public class MyRouteBuilder extends RouteBuilder {
          @Override
          public void configure() throws Exception {
              ElasticsearchComponent elasticsearchComponent = new ElasticsearchComponent();
              elasticsearchComponent.setHostAddresses("my-openshift-es-service");
              elasticsearchComponent.setUser("elastic");
              elasticsearchComponent.setPassword("mypw");
              getContext().addComponent("elasticsearch-rest", elasticsearchComponent);
              from("timer:x?repeatCount=1").setBody(constant(new GetRequest("myindex").id("myid"))).to("elasticsearch-rest://elasticsearch").log("${body}");
          }
      }
      

      However, When I run the integration, all I get is connection refused. I found one thread in our chat (I will post link into the comment) where Maria had the same issue and the workaround was to disable autowiring, as the camel was using an elasticsearch client that comes from quarkus as the default client, and my options were ignored.

      I couldn't find an issue about it anywhere, so this issue is about either:

      • fixing it to use the options I specified and not some default client I don't know about
      • document how to configure it through quarkus properties so that I don't need to create the component manually
      • document that the user needs to add getContext().setAutowiredEnabled(false); to make it work

          1.
          Documentation Sub-task Closed Undefined Unassigned
          2.
          Productization Sub-task Closed Undefined Unassigned
          3.
          Review Test Sub-task Closed Undefined Unassigned
          4.
          Development Sub-task Closed Undefined Unassigned

              Unassigned Unassigned
              avano@redhat.com Andrej Vano
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: