camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: load a route into ActiveMQ via java
Date Wed, 28 Jul 2010 17:54:22 GMT
On Wed, Jul 28, 2010 at 7:51 PM, Mark <elihusmails@gmail.com> 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

Mime
View raw message