Re: Filtering on message body content

2012-09-12 Thread Claus Ibsen
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


Re: Filtering on message body content

2012-09-12 Thread chris . odom

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.


Re: Filtering on message body content

2012-09-12 Thread Claus Ibsen
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


Re: Filtering on message body content

2012-09-12 Thread chris . odom
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 
queuethought 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.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.




Re: Filtering on message body content

2012-09-12 Thread chris . odom

I have also have another route that uses this which works correctly...


@Override
public void configure() throws Exception {

from(requestEndpoint).routeId(createRouteId())
.filter(header(headerName).isEqualTo(headerValue))
.to(destinationEndpoint).end();
}

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.