RnD-John commented on issue #1079: Example Request: CamelJmsToFileExample.java
URL: https://github.com/apache/camel-k/issues/1079#issuecomment-562288177
 
 
   **Question:**
   How do I pass my connection factory URI as an argument?
   
   **Background:**
   I was able to connect to an ActiveMQ broker using the code posted here. Upon 
trying to parameterize the code so that I can pass in the queue name and the 
URI from the command line, I found that I can only use the --property command 
to set sub-strings within the Camel-K DSL portion.
   
   using the command:
   kamel run -d mvn:org.apache.activemq:activemq-all:5.5.1 -d 
mvn:org.apache.activemq:activemq-camel:5.5.1 -p my.message="It WORKED" -p 
my.message2="STILL" -p my.queue="camelktest" -p my.uri="<myFQDN>" --name 
"ParameterizedBAMQ" BasicAMQ.java 
   
   on the file:
   BasicAMQ.java:
   `import org.apache.camel.builder.RouteBuilder;
   import org.apache.camel.CamelContext;
   import org.apache.camel.component.jms.JmsComponent;
   import org.apache.camel.ProducerTemplate;
   
   import javax.jms.ConnectionFactory;
   
   import org.apache.activemq.ActiveMQConnectionFactory;
   
   public class BasicAMQ extends RouteBuilder {
     @Override
     public void configure() throws Exception {
   
           ConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory("{{my.uri}}");
   
           CamelContext context = getContext();
           // Note we can explicit name the component
           context.addComponent("test-jms", 
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
   
             from("test-jms:queue:{{my.queue}}.queue")
                   .log("{{my.message}} {{my.message2}} ! ${body} ");
     }
   }`
   
   I get the error:
   Exception in thread "main" java.lang.IllegalArgumentException: Invalid 
broker URI: {{my.uri}}
   
   How do I pass my connection factory URI as an argument?
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to