stopping a route in spring dsl

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

stopping a route in spring dsl

jburkhardt-2
I've looked around JIRA and it seems using stop in spring dsl used to be an issue but has been resolved since Feb 09.  Perhaps I am attempting to use it incorrectly.
I am using Camel 2.0 M1

Here's what I'm trying to do:
I have a route that receives messages from a JMS queue.
After receiving the message it is run through a splitter, each "sub-message" for lack of a better term, gets run through a validation process and a security process.  The results are then aggregated back together and continue on the route.

Here is what I'm doing now in my spring dsl:
<camel:route>
  <camel:from uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>   
  <camel:split strategyRef="myAggregationStrategyBean">
    <xpath>//myxpath</xpath>
    <camel:process ref="validationProcessor"/>
    <camel:process ref="securityProcessor"/>       
  </camel:split>
.
.
.
</camel:route>

Right now this works okay - I set an exception on the exchange in the validation or security process if it fails, and it does not get past the split.
My issue is if it fails the validation process, I don't want it to even bother going to the security process, let alone to the aggregator after that.  Likewise if it fails security I don't want the aggregator to be called.
Is this something that is possible?  Or is there some better way to accomplish what I am trying to do?

I have tried defining an interceptor like this:
<camel:intercept>
  <camel:when>
    <simple>${exception.message} != null</simple>
  </camel:when>
  <camel:stop/>
</camel:intercept> 

Hoping that the interceptor would pick when I had set an exception on the exchange and stop the route.  This doesn't seem to have any effect.  The aggregator is still called every time.

Any help, especially if I am trying to do something completely the wrong way, would be much appreciated.
Thanks,
Jason
Reply | Threaded
Open this post in threaded view
|

Re:stopping a route in spring dsl

Bruno Borges
Have you tried to put that processor as a filter before the split?



Em 30/04/2009 17:13, jburkhardt <[hidden email]> escreveu:


> I've looked around JIRA and it seems using stop in spring dsl used to be  
> an

> issue but has been resolved since Feb 09. Perhaps I am attempting to use  
> it

> incorrectly.

> I am using Camel 2.0 M1



> Here's what I'm trying to do:

> I have a route that receives messages from a JMS queue.

> After receiving the message it is run through a splitter,  
> each "sub-message"

> for lack of a better term, gets run through a validation process and a

> security process. The results are then aggregated back together and

> continue on the route.



> Here is what I'm doing now in my spring dsl:




> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>



> //myxpath







> .

> .

> .





> Right now this works okay - I set an exception on the exchange in the

> validation or security process if it fails, and it does not get past the

> split.

> My issue is if it fails the validation process, I don't want it to even

> bother going to the security process, let alone to the aggregator after

> that. Likewise if it fails security I don't want the aggregator to be

> called.

> Is this something that is possible? Or is there some better way to

> accomplish what I am trying to do?



> I have tried defining an interceptor like this:





> ${exception.message} != null









> Hoping that the interceptor would pick when I had set an exception on the

> exchange and stop the route. This doesn't seem to have any effect. The

> aggregator is still called every time.



> Any help, especially if I am trying to do something completely the wrong

> way, would be much appreciated.

> Thanks,

> Jason

> --

> View this message in context:  
> http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html

> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: Re:stopping a route in spring dsl

jburkhardt-2
Hmm.. I'm trying to think of how that would work for my purposes.. A little background on why I'm doing the split and what not there.
Each JMS message I get in contains many individual XML messages.. it could be 1, 10, 100 or anything.  I'm splitting to find each of those and separately validate and check them for security, then I'm taking all the ones that pass those tests and reassembling them into a JMS message.
So I may have 10 come inside the initial JMS message and due to security or validation reasons 3 may end up being dropped, I'll send out the remaining 7 as another JMS message.

I'm not too sure how it would look to use a filter against the entire JMS message and send each individual XML message to the processor.. it just seems like there will always be a split involved.  

Is there something I'm just not seeing?

Bruno Borges wrote
Have you tried to put that processor as a filter before the split?



Em 30/04/2009 17:13, jburkhardt <jasonburkhardt@yahoo.com> escreveu:


> I've looked around JIRA and it seems using stop in spring dsl used to be  
> an

> issue but has been resolved since Feb 09. Perhaps I am attempting to use  
> it

> incorrectly.

> I am using Camel 2.0 M1



> Here's what I'm trying to do:

> I have a route that receives messages from a JMS queue.

> After receiving the message it is run through a splitter,  
> each "sub-message"

> for lack of a better term, gets run through a validation process and a

> security process. The results are then aggregated back together and

> continue on the route.



> Here is what I'm doing now in my spring dsl:




> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>



> //myxpath







> .

> .

> .





> Right now this works okay - I set an exception on the exchange in the

> validation or security process if it fails, and it does not get past the

> split.

> My issue is if it fails the validation process, I don't want it to even

> bother going to the security process, let alone to the aggregator after

> that. Likewise if it fails security I don't want the aggregator to be

> called.

> Is this something that is possible? Or is there some better way to

> accomplish what I am trying to do?



> I have tried defining an interceptor like this:





> ${exception.message} != null









> Hoping that the interceptor would pick when I had set an exception on the

> exchange and stop the route. This doesn't seem to have any effect. The

> aggregator is still called every time.



> Any help, especially if I am trying to do something completely the wrong

> way, would be much appreciated.

> Thanks,

> Jason

> --

> View this message in context:  
> http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html

> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





-----
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld
Reply | Threaded
Open this post in threaded view
|

Re: stopping a route in spring dsl

Claus Ibsen-2
In reply to this post by jburkhardt-2
On Thu, Apr 30, 2009 at 10:13 PM, jburkhardt <[hidden email]> wrote:

>
> I've looked around JIRA and it seems using stop in spring dsl used to be an
> issue but has been resolved since Feb 09.  Perhaps I am attempting to use it
> incorrectly.
> I am using Camel 2.0 M1
>
> Here's what I'm trying to do:
> I have a route that receives messages from a JMS queue.
> After receiving the message it is run through a splitter, each "sub-message"
> for lack of a better term, gets run through a validation process and a
> security process.  The results are then aggregated back together and
> continue on the route.
>
> Here is what I'm doing now in my spring dsl:
> <camel:route>
>  <camel:from
> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>  <camel:split strategyRef="myAggregationStrategyBean">
>    <xpath>//myxpath</xpath>
>    <camel:process ref="validationProcessor"/>
>    <camel:process ref="securityProcessor"/>
>  </camel:split>
> .
> .
> .
> </camel:route>
>
> Right now this works okay - I set an exception on the exchange in the
> validation or security process if it fails, and it does not get past the
> split.
> My issue is if it fails the validation process, I don't want it to even
> bother going to the security process, let alone to the aggregator after
> that.  Likewise if it fails security I don't want the aggregator to be
> called.
> Is this something that is possible?  Or is there some better way to
> accomplish what I am trying to do?

Take a look at the filter EIP. It can drop unwanted messages.
http://camel.apache.org/message-filter.html

And should be what your are looking for.


>
> I have tried defining an interceptor like this:
> <camel:intercept>
>  <camel:when>
>    <simple>${exception.message} != null</simple>
>  </camel:when>
>  <camel:stop/>
> </camel:intercept>
>
> Hoping that the interceptor would pick when I had set an exception on the
> exchange and stop the route.  This doesn't seem to have any effect.  The
> aggregator is still called every time.

Yeah the intercept is really for incoming messages, should have had a
better name IMHO.
I recently blogged about it and updated the wiki about interceptors in Camel:
http://camel.apache.org/intercept.html



>
> Any help, especially if I am trying to do something completely the wrong
> way, would be much appreciated.
> Thanks,
> Jason
> --
> View this message in context: http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Reply | Threaded
Open this post in threaded view
|

Re: stopping a route in spring dsl

jburkhardt-2
Ahhh alright after some more time reading I've come up with a solution thanks to you guys..  Here is what I've got now (publish route omitted):
<camel:route>
  <camel:from uri="direct:processors"/>
  <camel:process ref="validationProcessor"/>
  <camel:filter>
    <simple>${in.body} != null</simple>
    <camel:process ref="securityProcessor"/>
  </camel:filter>
</camel:route>

<camel:route>
  <camel:from uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
  <camel:split strategyRef="myAggregationStrategy">
    <xpath>//myxpath</xpath>
    <camel:to uri="direct:processors"/>
  </camel:split>
  <camel:filter>
    <simple>${in.body} != null</simple>
    <camel:to uri="direct:publish"/>
  </camel:filter>
</camel:route>

This seems to work well..  Any critiques or suggestions for how I could improve things further are very welcome.
Thanks,
Jason


Claus Ibsen-2 wrote
On Thu, Apr 30, 2009 at 10:13 PM, jburkhardt <jasonburkhardt@yahoo.com> wrote:
>
> I've looked around JIRA and it seems using stop in spring dsl used to be an
> issue but has been resolved since Feb 09.  Perhaps I am attempting to use it
> incorrectly.
> I am using Camel 2.0 M1
>
> Here's what I'm trying to do:
> I have a route that receives messages from a JMS queue.
> After receiving the message it is run through a splitter, each "sub-message"
> for lack of a better term, gets run through a validation process and a
> security process.  The results are then aggregated back together and
> continue on the route.
>
> Here is what I'm doing now in my spring dsl:
> <camel:route>
>  <camel:from
> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>  <camel:split strategyRef="myAggregationStrategyBean">
>    <xpath>//myxpath</xpath>
>    <camel:process ref="validationProcessor"/>
>    <camel:process ref="securityProcessor"/>
>  </camel:split>
> .
> .
> .
> </camel:route>
>
> Right now this works okay - I set an exception on the exchange in the
> validation or security process if it fails, and it does not get past the
> split.
> My issue is if it fails the validation process, I don't want it to even
> bother going to the security process, let alone to the aggregator after
> that.  Likewise if it fails security I don't want the aggregator to be
> called.
> Is this something that is possible?  Or is there some better way to
> accomplish what I am trying to do?

Take a look at the filter EIP. It can drop unwanted messages.
http://camel.apache.org/message-filter.html

And should be what your are looking for.


>
> I have tried defining an interceptor like this:
> <camel:intercept>
>  <camel:when>
>    <simple>${exception.message} != null</simple>
>  </camel:when>
>  <camel:stop/>
> </camel:intercept>
>
> Hoping that the interceptor would pick when I had set an exception on the
> exchange and stop the route.  This doesn't seem to have any effect.  The
> aggregator is still called every time.

Yeah the intercept is really for incoming messages, should have had a
better name IMHO.
I recently blogged about it and updated the wiki about interceptors in Camel:
http://camel.apache.org/intercept.html



>
> Any help, especially if I am trying to do something completely the wrong
> way, would be much appreciated.
> Thanks,
> Jason
> --
> View this message in context: http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Reply | Threaded
Open this post in threaded view
|

Re: stopping a route in spring dsl

Claus Ibsen-2
Hi

You might want to double check your predicate works as expected
  <simple>${in.body} != null</simple>

The simple language might not work with null as such. I guess I need
to double check myself.
And it reminds me we might want to add a better syntax error detection
as well. I will go create a ticket about this.


On Fri, May 1, 2009 at 8:54 PM, jburkhardt <[hidden email]> wrote:

>
> Ahhh alright after some more time reading I've come up with a solution thanks
> to you guys..  Here is what I've got now (publish route omitted):
> <camel:route>
>  <camel:from uri="direct:processors"/>
>  <camel:process ref="validationProcessor"/>
>  <camel:filter>
>    <simple>${in.body} != null</simple>
>    <camel:process ref="securityProcessor"/>
>  </camel:filter>
> </camel:route>
>
> <camel:route>
>  <camel:from
> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>  <camel:split strategyRef="myAggregationStrategy">
>    <xpath>//myxpath</xpath>
>    <camel:to uri="direct:processors"/>
>  </camel:split>
>  <camel:filter>
>    <simple>${in.body} != null</simple>
>    <camel:to uri="direct:publish"/>
>  </camel:filter>
> </camel:route>
>
> This seems to work well..  Any critiques or suggestions for how I could
> improve things further are very welcome.
> Thanks,
> Jason
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Apr 30, 2009 at 10:13 PM, jburkhardt <[hidden email]>
>> wrote:
>>>
>>> I've looked around JIRA and it seems using stop in spring dsl used to be
>>> an
>>> issue but has been resolved since Feb 09.  Perhaps I am attempting to use
>>> it
>>> incorrectly.
>>> I am using Camel 2.0 M1
>>>
>>> Here's what I'm trying to do:
>>> I have a route that receives messages from a JMS queue.
>>> After receiving the message it is run through a splitter, each
>>> "sub-message"
>>> for lack of a better term, gets run through a validation process and a
>>> security process.  The results are then aggregated back together and
>>> continue on the route.
>>>
>>> Here is what I'm doing now in my spring dsl:
>>> <camel:route>
>>>  <camel:from
>>> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>>>  <camel:split strategyRef="myAggregationStrategyBean">
>>>    <xpath>//myxpath</xpath>
>>>    <camel:process ref="validationProcessor"/>
>>>    <camel:process ref="securityProcessor"/>
>>>  </camel:split>
>>> .
>>> .
>>> .
>>> </camel:route>
>>>
>>> Right now this works okay - I set an exception on the exchange in the
>>> validation or security process if it fails, and it does not get past the
>>> split.
>>> My issue is if it fails the validation process, I don't want it to even
>>> bother going to the security process, let alone to the aggregator after
>>> that.  Likewise if it fails security I don't want the aggregator to be
>>> called.
>>> Is this something that is possible?  Or is there some better way to
>>> accomplish what I am trying to do?
>>
>> Take a look at the filter EIP. It can drop unwanted messages.
>> http://camel.apache.org/message-filter.html
>>
>> And should be what your are looking for.
>>
>>
>>>
>>> I have tried defining an interceptor like this:
>>> <camel:intercept>
>>>  <camel:when>
>>>    <simple>${exception.message} != null</simple>
>>>  </camel:when>
>>>  <camel:stop/>
>>> </camel:intercept>
>>>
>>> Hoping that the interceptor would pick when I had set an exception on the
>>> exchange and stop the route.  This doesn't seem to have any effect.  The
>>> aggregator is still called every time.
>>
>> Yeah the intercept is really for incoming messages, should have had a
>> better name IMHO.
>> I recently blogged about it and updated the wiki about interceptors in
>> Camel:
>> http://camel.apache.org/intercept.html
>>
>>
>>
>>>
>>> Any help, especially if I am trying to do something completely the wrong
>>> way, would be much appreciated.
>>> Thanks,
>>> Jason
>>> --
>>> View this message in context:
>>> http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> Apache Camel Reference Card:
>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>
>>
>
> --
> View this message in context: http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23338072.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Reply | Threaded
Open this post in threaded view
|

Re: stopping a route in spring dsl

Claus Ibsen-2
Ticket created
https://issues.apache.org/activemq/browse/CAMEL-1582

On Sat, May 2, 2009 at 9:25 AM, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> You might want to double check your predicate works as expected
>  <simple>${in.body} != null</simple>
>
> The simple language might not work with null as such. I guess I need
> to double check myself.
> And it reminds me we might want to add a better syntax error detection
> as well. I will go create a ticket about this.
>
>
> On Fri, May 1, 2009 at 8:54 PM, jburkhardt <[hidden email]> wrote:
>>
>> Ahhh alright after some more time reading I've come up with a solution thanks
>> to you guys..  Here is what I've got now (publish route omitted):
>> <camel:route>
>>  <camel:from uri="direct:processors"/>
>>  <camel:process ref="validationProcessor"/>
>>  <camel:filter>
>>    <simple>${in.body} != null</simple>
>>    <camel:process ref="securityProcessor"/>
>>  </camel:filter>
>> </camel:route>
>>
>> <camel:route>
>>  <camel:from
>> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>>  <camel:split strategyRef="myAggregationStrategy">
>>    <xpath>//myxpath</xpath>
>>    <camel:to uri="direct:processors"/>
>>  </camel:split>
>>  <camel:filter>
>>    <simple>${in.body} != null</simple>
>>    <camel:to uri="direct:publish"/>
>>  </camel:filter>
>> </camel:route>
>>
>> This seems to work well..  Any critiques or suggestions for how I could
>> improve things further are very welcome.
>> Thanks,
>> Jason
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Thu, Apr 30, 2009 at 10:13 PM, jburkhardt <[hidden email]>
>>> wrote:
>>>>
>>>> I've looked around JIRA and it seems using stop in spring dsl used to be
>>>> an
>>>> issue but has been resolved since Feb 09.  Perhaps I am attempting to use
>>>> it
>>>> incorrectly.
>>>> I am using Camel 2.0 M1
>>>>
>>>> Here's what I'm trying to do:
>>>> I have a route that receives messages from a JMS queue.
>>>> After receiving the message it is run through a splitter, each
>>>> "sub-message"
>>>> for lack of a better term, gets run through a validation process and a
>>>> security process.  The results are then aggregated back together and
>>>> continue on the route.
>>>>
>>>> Here is what I'm doing now in my spring dsl:
>>>> <camel:route>
>>>>  <camel:from
>>>> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>>>>  <camel:split strategyRef="myAggregationStrategyBean">
>>>>    <xpath>//myxpath</xpath>
>>>>    <camel:process ref="validationProcessor"/>
>>>>    <camel:process ref="securityProcessor"/>
>>>>  </camel:split>
>>>> .
>>>> .
>>>> .
>>>> </camel:route>
>>>>
>>>> Right now this works okay - I set an exception on the exchange in the
>>>> validation or security process if it fails, and it does not get past the
>>>> split.
>>>> My issue is if it fails the validation process, I don't want it to even
>>>> bother going to the security process, let alone to the aggregator after
>>>> that.  Likewise if it fails security I don't want the aggregator to be
>>>> called.
>>>> Is this something that is possible?  Or is there some better way to
>>>> accomplish what I am trying to do?
>>>
>>> Take a look at the filter EIP. It can drop unwanted messages.
>>> http://camel.apache.org/message-filter.html
>>>
>>> And should be what your are looking for.
>>>
>>>
>>>>
>>>> I have tried defining an interceptor like this:
>>>> <camel:intercept>
>>>>  <camel:when>
>>>>    <simple>${exception.message} != null</simple>
>>>>  </camel:when>
>>>>  <camel:stop/>
>>>> </camel:intercept>
>>>>
>>>> Hoping that the interceptor would pick when I had set an exception on the
>>>> exchange and stop the route.  This doesn't seem to have any effect.  The
>>>> aggregator is still called every time.
>>>
>>> Yeah the intercept is really for incoming messages, should have had a
>>> better name IMHO.
>>> I recently blogged about it and updated the wiki about interceptors in
>>> Camel:
>>> http://camel.apache.org/intercept.html
>>>
>>>
>>>
>>>>
>>>> Any help, especially if I am trying to do something completely the wrong
>>>> way, would be much appreciated.
>>>> Thanks,
>>>> Jason
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23338072.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Reply | Threaded
Open this post in threaded view
|

Re: stopping a route in spring dsl

Claus Ibsen-2
In reply to this post by Claus Ibsen-2
On Sat, May 2, 2009 at 9:25 AM, Claus Ibsen <[hidden email]> wrote:
> Hi
>
> You might want to double check your predicate works as expected
>  <simple>${in.body} != null</simple>
>
> The simple language might not work with null as such. I guess I need
> to double check myself.
> And it reminds me we might want to add a better syntax error detection
> as well. I will go create a ticket about this.
Well in fact it does. The != null and == null is build in already.
Well thats just the goodie about Camel that its clever itself.

    public void testIsNull() throws Exception {
        assertExpression("${in.header.foo} == null", false);
        assertExpression("${in.header.none} == null", true);
    }

    public void testIsNotNull() throws Exception {
        assertExpression("${in.header.foo} != null", true);
        assertExpression("${in.header.none} != null", false);
    }


>
>
> On Fri, May 1, 2009 at 8:54 PM, jburkhardt <[hidden email]> wrote:
>>
>> Ahhh alright after some more time reading I've come up with a solution thanks
>> to you guys..  Here is what I've got now (publish route omitted):
>> <camel:route>
>>  <camel:from uri="direct:processors"/>
>>  <camel:process ref="validationProcessor"/>
>>  <camel:filter>
>>    <simple>${in.body} != null</simple>
>>    <camel:process ref="securityProcessor"/>
>>  </camel:filter>
>> </camel:route>
>>
>> <camel:route>
>>  <camel:from
>> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>>  <camel:split strategyRef="myAggregationStrategy">
>>    <xpath>//myxpath</xpath>
>>    <camel:to uri="direct:processors"/>
>>  </camel:split>
>>  <camel:filter>
>>    <simple>${in.body} != null</simple>
>>    <camel:to uri="direct:publish"/>
>>  </camel:filter>
>> </camel:route>
>>
>> This seems to work well..  Any critiques or suggestions for how I could
>> improve things further are very welcome.
>> Thanks,
>> Jason
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Thu, Apr 30, 2009 at 10:13 PM, jburkhardt <[hidden email]>
>>> wrote:
>>>>
>>>> I've looked around JIRA and it seems using stop in spring dsl used to be
>>>> an
>>>> issue but has been resolved since Feb 09.  Perhaps I am attempting to use
>>>> it
>>>> incorrectly.
>>>> I am using Camel 2.0 M1
>>>>
>>>> Here's what I'm trying to do:
>>>> I have a route that receives messages from a JMS queue.
>>>> After receiving the message it is run through a splitter, each
>>>> "sub-message"
>>>> for lack of a better term, gets run through a validation process and a
>>>> security process.  The results are then aggregated back together and
>>>> continue on the route.
>>>>
>>>> Here is what I'm doing now in my spring dsl:
>>>> <camel:route>
>>>>  <camel:from
>>>> uri="jmsBean:queue:IncomingQueue?exchangePattern=InOut?disableReplyTo=true"/>
>>>>  <camel:split strategyRef="myAggregationStrategyBean">
>>>>    <xpath>//myxpath</xpath>
>>>>    <camel:process ref="validationProcessor"/>
>>>>    <camel:process ref="securityProcessor"/>
>>>>  </camel:split>
>>>> .
>>>> .
>>>> .
>>>> </camel:route>
>>>>
>>>> Right now this works okay - I set an exception on the exchange in the
>>>> validation or security process if it fails, and it does not get past the
>>>> split.
>>>> My issue is if it fails the validation process, I don't want it to even
>>>> bother going to the security process, let alone to the aggregator after
>>>> that.  Likewise if it fails security I don't want the aggregator to be
>>>> called.
>>>> Is this something that is possible?  Or is there some better way to
>>>> accomplish what I am trying to do?
>>>
>>> Take a look at the filter EIP. It can drop unwanted messages.
>>> http://camel.apache.org/message-filter.html
>>>
>>> And should be what your are looking for.
>>>
>>>
>>>>
>>>> I have tried defining an interceptor like this:
>>>> <camel:intercept>
>>>>  <camel:when>
>>>>    <simple>${exception.message} != null</simple>
>>>>  </camel:when>
>>>>  <camel:stop/>
>>>> </camel:intercept>
>>>>
>>>> Hoping that the interceptor would pick when I had set an exception on the
>>>> exchange and stop the route.  This doesn't seem to have any effect.  The
>>>> aggregator is still called every time.
>>>
>>> Yeah the intercept is really for incoming messages, should have had a
>>> better name IMHO.
>>> I recently blogged about it and updated the wiki about interceptors in
>>> Camel:
>>> http://camel.apache.org/intercept.html
>>>
>>>
>>>
>>>>
>>>> Any help, especially if I am trying to do something completely the wrong
>>>> way, would be much appreciated.
>>>> Thanks,
>>>> Jason
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23322604.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> Apache Camel Reference Card:
>>> http://refcardz.dzone.com/refcardz/enterprise-integration
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/stopping-a-route-in-spring-dsl-tp23322604p23338072.html
>> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> Apache Camel Reference Card:
> http://refcardz.dzone.com/refcardz/enterprise-integration
>



--
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration