camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chris.o...@mediadriver.com
Subject Re: Filtering on message body content
Date Wed, 12 Sep 2012 15:39:31 GMT
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?


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.odom@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.odom@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.


Mime
View raw message