On Wed, Sep 12, 2012 at 5:39 PM, <chris.o...@mediadriver.com> wrote: > The idea is to start up a route to selectively move messages from one queue > to another based on an expression. This is, as far as I know, the Selective > Consumer EIP. The idea would be if the filter returns true, move the message > to the next destination otherwise leave it in the queue....thought this > would be pretty straight forward. Is there a better way of implementing a > Selective Consumer EIP? >
No that would not happend. The message will *always* be consumed from the queue. The messages that filters = false, will be dropped, You cannot leave a message on a JMS queue. You can though use JMS Message selectors, to only consume certain messages. But this is JMS specific, and not Camel. An alternative is to use a content based router, and then move the message back again from A if foo then to B else to A Though the ordering of the message will change. And you risk having an endless loop of messages. > > > On 2012-09-12 10:09, Claus Ibsen wrote: >> >> And without the filter so its straight from -> to. Does that work for you? >> >> >> On Wed, Sep 12, 2012 at 4:26 PM, <chris.o...@mediadriver.com> wrote: >>> >>> Thanks for the response Claus, >>> >>> Here is the routes Description: >>> >>> EventDrivenConsumerRoute[Endpoint[activemq://queue:esigSigRqst] -> >>> >>> Instrumentation:route[UnitOfWork(RouteContextProcessor[Channel[Filter[if: >>> bodyAs[java.lang.String] contains POS do: >>> Channel[sendTo(Endpoint[activemq://queue:esigSigDecrypt])]]]])]] >>> >>> As you can see the content value is set 'POS' but still all messages get >>> dequeued from the esigSigRqst queue and never get enqueued to >>> esigSigDecrypt >>> queue. The message bodies are text xml and I know that they contain 'POS' >>> with in the text. The stranger part is I ran this same route with content >>> set to 'DooDoo' and I got the same result, all messages dequeued and no >>> messages enqueued. >>> >>> Thanks. >>> >>> >>> On 2012-09-12 09:12, Claus Ibsen wrote: >>>> >>>> >>>> If the messages gets dequed only, then the expression returns false, >>>> so the message gets dropped. >>>> >>>> Make sure the value "content" has been set before the configure method >>>> is invoked. >>>> For example you can do a System out println of content variable from >>>> the configure meyhod. It may be null at the time. >>>> >>>> On Wed, Sep 12, 2012 at 3:19 PM, <chris.o...@mediadriver.com> wrote: >>>>> >>>>> >>>>> I created a route that I was trying to use to filter messages from a >>>>> destination. >>>>> >>>>> @Override >>>>> public void configure() throws Exception { >>>>> >>>>> from(requestEndpoint).routeId(createRouteId()) >>>>> .filter(body(String.class).contains(content)) >>>>> .to(destinationEndpoint).end(); >>>>> } >>>>> >>>>> The route runs and broker dispatches and dequeues every message no >>>>> matter >>>>> what and the route never places the message to its destination, no >>>>> matter >>>>> what. I know I can check to see if there are matching but I have not >>>>> gotten >>>>> around to putting in any of this logic to see if the expression >>>>> matched. >>>>> Just wondering if anyone knows why this is happening or if anyone seen >>>>> this >>>>> before. >>>>> >>>>> Thanks >>>>> Chris Odom. > > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen