Hi,
You should call the bind method instead of main.getOrCreateCamelContext() to
add the configured the ActiveMQComponent like this.
main.bind(
"activemq",
amq.activeMQComponent("tcp://ourbrokerserver.workplace.com:61616"));
main.getOrCreateCamelContext() just create a new camel map per call.
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On April 1, 2015 at 11:55:49 PM, Wilkerson, Daniel ([email protected])
wrote:
> I'm trying to add the correct tcp:// connection url to the camel context in a
> standalone/Java
> DSL camel app and am using a boot() method that was pulled from example code
> on the camel
> site. In my boot() method I'm trying to add the correct URL to the camel
> context but it's
> not getting added. When the code runs its still looking for a broker on
> localhost instead
> of the broker server I passed. How do I get the URL to be picked up in the
> context so my Java
> DSL route can connect to the correct server?
>
> @SuppressWarnings("static-access")
> public void boot() throws Exception {
> // create a Main instance
> main = new Main();
> // enable hangup support so you can press ctrl + c to terminate the JVM
> main.enableHangupSupport();
> ActiveMQComponent amq = new ActiveMQComponent();
>
> main.getOrCreateCamelContext().addComponent(
> "activemq",
> amq.activeMQComponent("tcp://ourbrokerserver.workplace.com:61616"));
> //ActiveMQComponent amq = new ActiveMQComponent();
>
> // add routes
> main.addRouteBuilder(new EtlProducerRouteBuilder());
> // run until you terminate the JVM
> System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");
> main.run();
> }
>
>