ppalaga commented on issue #1961:
URL: https://github.com/apache/camel-k/issues/1961#issuecomment-769930155


   @astefanutti is correct that the ConnectionFactory typically does not need 
to be created manually like in the snippet above. Passing 
`quarkus.qpid-jms.url`, `quarkus.qpid-jms.username` and 
`quarkus.qpid-jms.password` either via application.properties or via env 
vars/secrets `QUARKUS_QPID_JMS_URL`, etc. is simpler. See  
https://camel.apache.org/camel-quarkus/latest/reference/extensions/amqp.html#_additional_camel_quarkus_configuration
 and https://github.com/amqphub/quarkus-qpid-jms#configuration
   
   If you really need to create the ConnectionFactory manually, then CDI and 
MicroProfile Config is the way to go on Quarkus:
   
   ```java
   // camel-k: language=java property-file=application.properties
   // camel-k: dependency=github:keunlee:camel-k-starter-workbench
   
   import org.apache.camel.BindToRegistry;
   import org.apache.camel.PropertyInject;
   import org.apache.camel.builder.RouteBuilder;
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   import org.apache.qpid.jms.JmsConnectionFactory;
   
   public class HelloToAmqp extends RouteBuilder {
       private static final Logger LOG = 
LoggerFactory.getLogger(HelloToAmqp.class);
   
       
@org.eclipse.microprofile.config.inject.ConfigProperty("messaging.broker.url.amqp")
       String messagingBrokerUrl;
   
       @javax.enterprise.inject.Produces
       @javax.inject.Named("connectionFactory")
       public JmsConnectionFactory connectionFactory() throws Exception {
           return new JmsConnectionFactory(messagingBrokerUrl);
       }
   
       @Override
       public void configure() throws Exception {
           from("timer:refresh?period=5000&fixedRate=true")
           .setBody()
           .simple("Hello World ${header.firedTime}")
           .log("${body}")
           
.to("amqp:topic:example?exchangePattern=InOnly&connectionFactory=connectionFactory");
       }
   }
   ```


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


Reply via email to