Camel JMS failed to create producer -
i reasonably new camel , have been trying use requestbody keep getting error. i've simplified code , still same exception. if guess correct key message 'failed create producer endpoint' i'm not sure how using java dsl.
could please point me camel documentation shows me doing wrong. thank help.
here simplified code.
package nz.co.home.cameljmsrequest; import org.apache.camel.camelcontext; import org.apache.camel.producertemplate; import org.apache.camel.component.activemq.activemqcomponent; import org.apache.camel.impl.defaultcamelcontext; public class app { public static void main(string[] args) throws exception { // set underlying camel context , add activemq component camelcontext camelcontext = new defaultcamelcontext(); camelcontext.addcomponent( "jms", activemqcomponent.activemqcomponent("tcp://192.168.1.150:61616") ); // start context camelcontext.start(); // send message producertemplate producer = camelcontext.createproducertemplate(); string requestbody = producer.requestbody("jms:queue:test", "request message", string.class); system.out.println(requestbody); // stop context camelcontext.stop(); // because can system.out.println("sent message"); } }
the resulting messages this:
exception in thread "main" org.apache.camel.camelexecutionexception: exception occurred during execution on exchange: exchange[message: request message] @ org.apache.camel.util.objecthelper.wrapcamelexecutionexception(objecthelper.java:1287) @ org.apache.camel.util.exchangehelper.extractresultbody(exchangehelper.java:618) @ org.apache.camel.impl.defaultproducertemplate.extractresultbody(defaultproducertemplate.java:454) @ org.apache.camel.impl.defaultproducertemplate.sendbody(defaultproducertemplate.java:120) @ org.apache.camel.impl.defaultproducertemplate.sendbody(defaultproducertemplate.java:136) @ org.apache.camel.impl.defaultproducertemplate.requestbody(defaultproducertemplate.java:284) @ org.apache.camel.impl.defaultproducertemplate.requestbody(defaultproducertemplate.java:314) @ nz.co.home.cameljmsrequest.app.main(app.java:23) caused by: org.apache.camel.failedtocreateproducerexception: failed create producer endpoint: endpoint[jms://queue:testcamelactivemq]. reason: java.lang.illegalargumentexception: connectionfactory must specified @ org.apache.camel.component.jms.jmsproducer.initreplymanager(jmsproducer.java:98) @ org.apache.camel.component.jms.jmsproducer.processinout(jmsproducer.java:164) @ org.apache.camel.component.jms.jmsproducer.process(jmsproducer.java:129) @ org.apache.camel.processor.unitofworkprocessor.processasync(unitofworkprocessor.java:150) @ org.apache.camel.processor.unitofworkprocessor.process(unitofworkprocessor.java:117) @ org.apache.camel.util.asyncprocessorhelper.process(asyncprocessorhelper.java:99) @ org.apache.camel.processor.delegateasyncprocessor.process(delegateasyncprocessor.java:86) @ org.apache.camel.processor.unitofworkproducer.process(unitofworkproducer.java:63) @ org.apache.camel.impl.producercache$2.doinproducer(producercache.java:366) @ org.apache.camel.impl.producercache$2.doinproducer(producercache.java:337) @ org.apache.camel.impl.producercache.doinproducer(producercache.java:233) @ org.apache.camel.impl.producercache.sendexchange(producercache.java:337) @ org.apache.camel.impl.producercache.send(producercache.java:192) @ org.apache.camel.impl.defaultproducertemplate.send(defaultproducertemplate.java:115) @ org.apache.camel.impl.defaultproducertemplate.sendbody(defaultproducertemplate.java:119) ... 4 more caused by: java.lang.illegalargumentexception: connectionfactory must specified @ org.apache.camel.util.objecthelper.notnull(objecthelper.java:290) @ org.apache.camel.component.jms.jmsconfiguration.createconnectionfactory(jmsconfiguration.java:1052) @ org.apache.camel.component.jms.jmsconfiguration.getconnectionfactory(jmsconfiguration.java:415) @ org.apache.camel.component.jms.jmsendpoint.getconnectionfactory(jmsendpoint.java:468) @ org.apache.camel.component.jms.reply.temporaryqueuereplymanager.createlistenercontainer(temporaryqueuereplymanager.java:115) @ org.apache.camel.component.jms.reply.replymanagersupport.dostart(replymanagersupport.java:222) @ org.apache.camel.support.servicesupport.start(servicesupport.java:60) @ org.apache.camel.util.servicehelper.startservice(servicehelper.java:62) @ org.apache.camel.util.servicehelper.startservice(servicehelper.java:52) @ org.apache.camel.component.jms.jmsproducer.createreplymanager(jmsproducer.java:503) @ org.apache.camel.component.jms.jmsproducer.initreplymanager(jmsproducer.java:94) ... 18 more
quite clear stacktrace issue not specifying activemq connectionfactory.
the configuration can done in spring xml.
please, have @ jms page - apache camel:jms
Comments
Post a Comment