Thanks James!

Is there any way to set activemq destination options programatically on a
Camel JMS endpoint object in 1.5.0?


James.Strachan wrote:
> 
> 2008/12/9 ariekenb <[EMAIL PROTECTED]>:
>>
>> 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.
> 
> We could enhance the ActiveMQ JmsEndpoint to support all of the
> options available on an ActiveMQDestination.
> 
> Though in the mean time, using trunk of Camel - you can now configure
> the JMS Destination object and set it into a JmsEndpoint as this test
> case shows...
> http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/config/JmsEndpointWithCustomDestinationTest-context.xml?view=markup
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

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

Reply via email to