java - Apache Camel send message JMS Consumer receives message -
java - Apache Camel send message JMS Consumer receives message -
have apache camel simple message route folder activemq topic:
//create context create endpoint, routes, processor within context scope camelcontext context = new defaultcamelcontext(); //create endpoint route context.addroutes(new routebuilder() { @override public void configure() throws exception { from("file:data/outbox").to("activemq:topic:vadim_topic"); //from("activemq:topic:test").to.to("file:data/outbox"); } }); context.start(); thread.sleep(5000); context.stop(); }
and jms implementation if topic consumer:
connectionfactory connectionfactory = new activemqconnectionfactory(); seek { connection connection = connectionfactory.createconnection(); session session = connection.createsession(false, session.auto_acknowledge); //connection.setclientid("12345"); connection.start(); topic topic = session.createtopic("vadim_topic"); messageconsumer messageconsumer = session.createconsumer(topic); messagelistener messagelistener = new messagelistener() { public void onmessage(message message) { textmessage textmessage = (textmessage) message; seek { system.out.println("received message: " + textmessage.gettext()); } grab (jmsexception e) { e.printstacktrace(); } } }; messageconsumer.setmessagelistener(messagelistener); } grab (exception e) { e.printstacktrace(); }
can't understand why consumer can't recieve messages sent camel route?? guess thet problem need subscribe jms consumer on messages sent camel? how can if case?
camel not allows send messages topic, can read messages topic , send 1 of pojos.
a route reads topic , sends messages pojo this:
class="lang-java prettyprint-override">from("activemq:topic:vadim_topic").bean(examplebean.class);
camel figure out method phone call on pojo depending on type of message received, , available method signatures. see page details on using pojo's in camel routes: https://camel.apache.org/bean.html
java jms apache-camel activemq
Comments
Post a Comment