camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ariekenb <aaron.j.riekenb...@lmco.com>
Subject Possible to set activemq destination options on camel endpoint?
Date Tue, 09 Dec 2008 17:19:45 GMT

I'm having problems setting activemq destination options
(http://activemq.apache.org/destination-options.html) on a camel endpoint. 
I'm wondering if this is supposed to be possible, or if I'm missing
something.

According to the "parallel processing and ordering" cookbook, setting
exclusive consumer on an endpoint using the activemq component is
recommended in clustering situations that require message ordering
(http://activemq.apache.org/camel/parallel-processing-and-ordering.html).

So I've tried to do this, as follows - I want to set the consumer.exclusive
and consumer.priority options for the endpoint:

	private class TestRouteBuilder extends RouteBuilder {
		@Override
		public void configure() throws Exception {
			from(
"activemq:queue:test.queue?consumer.exclusive=true&consumer.priority=10")
					.to("activemq:topic:test.topic");
		}
	}

			SpringCamelContext camelContext = SpringCamelContext
					.springCamelContext(applicationContext);

			camelContext.addComponent("activemq", ActiveMQComponent
					.activeMQComponent("tcp://localhost:61616"));

			camelContext.addRoutes(new TestRouteBuilder());
			camelContext.start();


When I try to start the camelContext, I get this exception:

org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:
activemq:queue:test.queue?consumer.exclusive=true&consumer.priority=10 due
to: org.apache.camel.ResolveEndpointFailedException: Failed to resolve
endpoint:
activemq:queue:test.queue?consumer.exclusive=true&consumer.priority=10 due
to: There are 2 parameters that couldn't be set on the endpoint. Check the
uri if the parameters are spelt correctly and that they are properties of
the endpoint. Unknown parameters=[{consumer.priority=10,
consumer.exclusive=true}]



I'm guessing the trouble is the "?" is overloaded here - in activemq it
would be used to specify destination options, but in the Camel JMS component
it is used to set configuration properties.


I tried being clever and modified my route as follows -
concurrentConsumers=1 is a property for the Camel JMS component.  I hoped
this would let the destination options (consumer.exclusive and
consumer.priority) be passed on the activemq.

 			from(
"activemq:queue:test.queue?consumer.exclusive=true&consumer.priority=10?concurrentConsumers=1")
					.to("activemq:topic:test.topic");

This allows the camelContext to start without error, but I've verified from
the broker view mbean in jconsole that Camel's subscription to test.queue is
NOT exclusive in this case.

The example code above uses the activemq component.  I've also tried using
the JMS component with the same results.

Thanks for any help or suggestions.
-- 
View this message in context: http://www.nabble.com/Possible-to-set-activemq-destination-options-on-camel-endpoint--tp20919263s22882p20919263.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message