You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/06/17 19:04:41 UTC

[GitHub] [camel-k] doru1004 opened a new issue #1541: Package not found

doru1004 opened a new issue #1541:
URL: https://github.com/apache/camel-k/issues/1541


   When trying to run kamel (RC2) on a Java file containing came code I get:
   
   ```
   RuntimeSupport - Found loader org.apache.camel.k.loader.java.JavaSourceLoader@39529185 for language java from service definition
   Exception in thread "main" org.apache.camel.RuntimeCamelException: org.joor.ReflectException: Compilation error: /org/apache/camel/kamel/KafkaProducer.java:6: error: package org.apache.camel.builder.component does not exist
   ```
   
   Any ideas what's going wrong?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 edited a comment on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 edited a comment on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646163535


   I put together a reactive streams example and it works great!! :) (using kamel RC2)


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646069436


   > camel-k does not require you to write your own main but you should focus on the integration logic, see as example https://github.com/apache/camel-k/tree/master/examples/kafka
   
   If I really want to, can I add runnable code though? Or do I have to restrict myself to route building?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646149246


   Thanks a lot for the clarification. This is very helpful! 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646118324


   The idiomatic way would be to expose a web service through the REST DSL and invoke it 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646106024


   Of course :)
   
   I was looking at this Camel example here:
   
   https://github.com/apache/camel-examples/blob/master/examples/camel-example-kafka/src/main/java/org/apache/camel/example/kafka/MessagePublisherClient.java
   
   and I am trying to put that into Camel K.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 closed issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 closed issue #1541:
URL: https://github.com/apache/camel-k/issues/1541


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli edited a comment on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646043043


   You need to add a dependency on the camel-componentdsl as it is not included by default, something like:
   
       kamel run -d camel-componentdsl KafkaProducer.java
   
   but you don't need use a ComponentsBuilderFactory if you want to configure component level properties
   
       kamel run --property camel.component.kafka.brokers=... KafkaProducer.java
   
   should be equivalent to what you had in the example
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646163535


   I put together a reactive streams example and it works great!! :)


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646040549


   I was trying to write a client for the consumer example.
   
   Even if I don't include a main, the error seems to occur because of the code I have in my configure method.
   
   What's the rule for what to include and not to include in the code passed to kamel run?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646067874


   I guess that should have been my question from the start, a way to actually add dependencies if they are not  included in the default setup! :) Thanks for giving an example of how to add some.
   
   In case anyone else runs into this problem, I actually avoided the use of the component factory by adding the broker details in the client code similarly to how they are used by the consumer:
   
   ```
   from(...)
      .to("kafka:topic?brokers=X.X.X.X:9092")
      .log("${body}");
   ```
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli edited a comment on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646043043


   You need to add a dependency on the camel-componentdsl as it is not included by default, something like:
   
       kamel run -d camel-componentdsl KafkaProducer.java
   
   but you don't need to use a ComponentsBuilderFactory if you want to configure component level properties
   
       kamel run --property camel.component.kafka.brokers=... KafkaProducer.java
   
   should be equivalent to what you had in the example
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 edited a comment on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 edited a comment on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646106024


   Of course :)
   
   I was looking at this Camel example here:
   
   https://github.com/apache/camel-examples/blob/master/examples/camel-example-kafka/src/main/java/org/apache/camel/example/kafka/MessagePublisherClient.java
   
   and I am trying to put that into Camel K.
   
   The question is I guess what happens to the code in between the `camelContext.start();` and `camelContext.stop();`. 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli edited a comment on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646043043


   You need to add a dependency on the camel-componentdsl as it is not included by default, something like:
   
       camel run -d camel-componentdsl KafkaProducer.java
   
   but you don't need use a ComponentsBuilderFactory if you want to configure component level properties
   
      camel run --property camel.component.kafka.brokers=... KafkaProducer.java
   
   should be equivalent to what you had in the example
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-645575514


   Can you post the full content of the java file ?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-645577988


   Thanks for the reply, sure:
   
   ```
   package org.apache.camel.kamel;
   
   import org.apache.camel.CamelContext;
   import org.apache.camel.Exchange;
   import org.apache.camel.builder.RouteBuilder;
   import org.apache.camel.builder.component.ComponentsBuilderFactory;
   import org.apache.camel.impl.DefaultCamelContext;
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   
   public final class KafkaProducer {
       private KafkaProducer() { }
   
       public static void main(String[] args) throws Exception {
           LOG.info("Starting Kafka-Camel integration...");
           CamelContext camelContext = new DefaultCamelContext();
   
           // Add route to send messages to Kafka.
           camelContext.addRoutes(new RouteBuilder() {
               public void configure() {
                   // Setup kafka component with the brokers.
                   ComponentsBuilderFactory.kafka()
                       .brokers("X.X.X.X:9092")
                       .register(camelContext, "kafka");
                 [...]
               }
           });
       }
   }
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-645804172


   camel-k does not require you to write your own main but you should focus on the integration logic, see as example https://github.com/apache/camel-k/tree/master/examples/kafka


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646217655


   Thanks for all the help! Closing since my initial issue is resolved.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646084145


   it depends what you mean by runnable code as you can provide some processors or other bits but in general you should focus on routes and other code can be provided through dependencies


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646043043


   You need to add a dependency on the camel-componentdsl as it is not included by default, something like:
   
       camel run -d camel-componentdsl KafkaProducer.java
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646097277


   What I had in mind was the usage of the routes, the code that performs a sendBody or requestBody. Can I include that in the code to kamel run?
   
   Also if I have route which contains a reactive stream, such as:
   
   ```
   from("timer:clock").
     .setBody().header(Exchange.TIMER_COUNTER)
     .to("some:consumer")
     .log("${body}")
   ```
   
   can I expect that to run?
   
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646101744


   > What I had in mind was the usage of the routes, the code that performs a sendBody or requestBody. Can I include that in the code to kamel run?
   > 
   
   can you scketch an example of what you want to achieve ?
   
   > Also if I have route which contains a reactive stream, such as:
   > 
   > ```
   > from("timer:clock").
   >   .setBody().header(Exchange.TIMER_COUNTER)
   >   .to("some:consumer")
   >   .log("${body}")
   > ```
   > 
   > can I expect that to run?
   
   It is a route so as long as you have all the dependencies it should work, if not get back to us :)
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] doru1004 commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
doru1004 commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646130066


   I just checked the saga example on here and it looks like it's using the pattern you mention above. I can use that as a blueprint.
   
   In regards to creating a CamelContext, adding the route builder to it and then invoking requestBody or sendBody using the routes in the builder, that's not possible? 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #1541: Package not found

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #1541:
URL: https://github.com/apache/camel-k/issues/1541#issuecomment-646135512


   camel-k creates a CamelContext for you and then it will load your routes so no, you can't create your own context and even if it could be possible to use requestBody/sendBody (by adding a listener that reacts to events), it is definitively not what we recommend and what we want to support.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org