camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: JMS Selectors in Camel
Date Mon, 01 Oct 2007 18:15:34 GMT
On 26/09/2007, jgunz <slobby@twcny.rr.com> wrote:
>
> On to the next problem! I'm having trouble adding a selector to my JMS
> consumer when using Camel. I want to selectively consume messages based on a
> header field but the selection HAS to be done within the broker so that I
> can limit the bandwidth required for consumers. I can't figure out how to do
> this though.
>
>
> ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
> context.addComponent("test-jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

You specify consumption options such as selector on the endpoint. This
was missed off the documentation page; I've just updated...
http://cwiki.apache.org/CAMEL/jms.html

You can specify the selector query argument on the URI to specify the
selector; though you might have to escape the = sign etc.

from("activemq:My.Queue?selector=foo%3D'bar'").to("log:foo")

Another option is to configure the endpoint directly...

JmsEndpoint endpoint = camelContext.getEndpoint("activemq:My.Queue",
JmsEndpoint.class);
endpoint.setSelector("foo='bar'");

-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Mime
View raw message