Thanks, I made that change an ActiveMQ starts up. The route does not show up in the camel admin page, so I am not sure if its being loaded properly. Plus when I send a message to "whatever", the listener on "junk" does not receive the message. The listener on "whatever" does receive the message though.
I think I still have something wrong. On Wed, Jul 28, 2010 at 1:54 PM, Claus Ibsen <[email protected]> wrote: > On Wed, Jul 28, 2010 at 7:51 PM, Mark <[email protected]> wrote: > > I am working to build a router in ActiveMQ. From what I have read I > should > > be able to package my class in a jar file, copy the jar file into > > $ACTIVEMQ_HOME/lib and then restart. Here is my simple router code: > > > > public class MyRouter extends RouteBuilder { > > > > public MyRouter() throws Exception { > > > > CamelContext context = new DefaultCamelContext(); > > ConnectionFactory connectionFactory = new > > ActiveMQConnectionFactory("tcp://localhost:61616"); > > context.addComponent("connectionFactory", > > JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); > > } > > > > @Override > > public void configure() throws Exception { > > > > from("jms:whatever").to("jms:junk"); > > } > > } > > > > When you add the component to Camel you have to use the name "jms" as > its the name you use in the Camel route > > > context.addComponent("connectionFactory", > > JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); > > Should then be > > context.addComponent("jms", > JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); > > > BTW you can name it what you like, instead of jms you can use activemq > as some of the examples use. > > > > > > > I am getting an exception in ActiveMQ upon startup: > > ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: > > org.apache.camel.RuntimeCamelException: > java.lang.IllegalArgumentException: > > connectionFactory must be specified > > java.lang.RuntimeException: Failed to execute start task. Reason: > > org.apache.camel.RuntimeCamelException: > java.lang.IllegalArgumentException: > > connectionFactory must be specified > > at > > > org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98) > > at > > > org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) > > at > > > org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:136) > > at > > > org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) > > at > > > org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:82) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at org.apache.activemq.console.Main.runTaskClass(Main.java:251) > > at org.apache.activemq.console.Main.main(Main.java:107) > > > > > > Could someone help me out as to what I can do to fix this. > > > > Thanks > > > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus >
