camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <qu...@pronoia-solutions.com>
Subject Re: How to return early from a direct: subroute?
Date Sun, 03 Apr 2016 16:23:25 GMT
Since you’re processing with beans, maybe you could combine the process and filter steps
to make your routes a little more concise?

You may have some pretty deeply nested XML, but it’s a little better

<route id="child_route">
    <from uri="direct:foo"/>
    <filter>
        <method ref="proc1" method="process"/>
        <filter>
            <method ref="proc2" method="process"/>
            <filter>
                <method ref="proc3" method="process"/>                         
                <method ref="proc4" method="process"/>
            </filter>
        </filter>
    </filter>
</route>

> On Apr 2, 2016, at 9:01 PM, bocamel <johnzyin@gmail.com> wrote:
> 
> Quinn,
> 
> 
> 
> Thanks for the response.  I think filter would be the closest solution to what I was
looking for – better than what I contemplated to do with setting some headers and using
<choice> in the route.  But they all have a problem with a long route having multiple
steps:
> 
> 
> 
> <route id="child_route"> 
>  <from uri="direct:foo"/> 
>  <process ref="proc1"/> 
>  <process ref="proc2"/> 
>  <process ref="proc3"/> 
>  <process ref="proc4"/> 
> </route>
> 
> 
> 
> If we want to be able to return from any point in proc1, proc2, proc3 or proc4, it would
be rather tedious to set up filters (or <choice>) at the beginning of each step.
> 
> 
> 
> Thanks again!
> 
> 
> 
> From: Quinn Stevenson [via Camel] [mailto:ml-node+s465427n5780329h77@n5.nabble.com] 
> Sent: Saturday, April 2, 2016 10:43 PM
> To: bocamel <johnzyin@gmail.com>
> Subject: Re: How to return early from a direct: subroute?
> 
> 
> 
> What about using a filter?  I think that can do what you’re after. 
> 
> 
>> On Apr 2, 2016, at 8:40 PM, bocamel <[hidden email]> wrote: 
>> 
>> Taariq, 
>> 
>> 
>> 
>> Thank you very much for your response.  I think your suggestion is very 
>> interesting, though it was not exactly what I was looking for. 
>> 
>> 
>> 
>> Conceptually, to me, a direct: route is just a method call.  But I cannot 
>> find an easy way to exit/return from such a method before it reaches its 
>> end.  While one might be able to use a dynamic router with slip returning a 
>> null value to fake this, it is not very straightforward.  I wish there is an 
>> exchange property ROUTE_RETURN that simply causes the exchange to exit the 
>> current route and returns to the parent route if it has a parent route. 
>> 
>> 
>> 
>> Thanks again! 
>> 
>> 
>> 
>> From: taariq [via Camel] [mailto:[hidden email] <mailto:[hidden email]>] 
>> Sent: Friday, April 1, 2016 3:36 PM 
>> To: bocamel <[hidden email] <mailto:[hidden email]>> 
>> Subject: Re: How to return early from a direct: subroute? 
>> 
>> 
>> 
>> Did you already look at the dynamic router and routing slip patterns? 
>> 
>> 
>>> On 01 Apr 2016, at 17:12, bocamel <[hidden email]> wrote: 
>>> 
>>> I have two routes: 
>>> 
>>> <route id="route1"> 
>>> <from .../> 
>>> <to uri="direct:foo"/> 
>>> <to uri=.../> 
>>> </route> 
>>> 
>>> <route id="route2"> 
>>> <from uri="direct:foo"/> 
>>> <process ref="proc1"/> 
>>> <process ref="proc2"/> 
>>> </route> 
>>> 
>>> What should I do if, in proc1, I want to - for certain exchanges - return 
>>> back to route1 without completing the entire route2?  I know the 
>> ROUTE_STOP 
>>> property, but that would stop the exchange completely (without going back 
>> to 
>>> route1).  I can also set some header(s) and then use <choice> in the 
>> route2 
>>> to achieve it.  But I wonder if there is something analogous to ROUTE_STOP 
>> 
>>> but more functions like ROUTE_RETURN. 
>>> 
>>> Any help would be greatly appreciated. 
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> View this message in context: 
>> http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute
>> -tp5780262.html 
>>> Sent from the Camel - Users mailing list archive at Nabble.com. 
>> 
>> 
>> 
>> _____   
>> 
>> If you reply to this email, your message will be added to the discussion 
>> below: 
>> 
>> http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute <http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute>

>> -tp5780262p5780271.html 
>> 
>> To unsubscribe from How to return early from a direct: subroute?, click here 
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscrib <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscrib>

>> e_by_code&node=5780262&code=am9obnp5aW5AZ21haWwuY29tfDU3ODAyNjJ8Mjk3Mjc3MTQ4

>>> . 
>> 
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_view <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_view>

>> er&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNa

>> mespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.No 
>> deNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_ema

>> ils%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML 
>> 
>> 
>> 
>> 
>> 
>> -- 
>> View this message in context: http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute-tp5780262p5780328.html
<http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute-tp5780262p5780328.html>

>> Sent from the Camel - Users mailing list archive at Nabble.com <http://nabble.com/>.

> 
> 
> 
> 
> 
>  _____  
> 
> If you reply to this email, your message will be added to the discussion below:
> 
> http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute-tp5780262p5780329.html

> 
> To unsubscribe from How to return early from a direct: subroute?, click here <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5780262&code=am9obnp5aW5AZ21haWwuY29tfDU3ODAyNjJ8Mjk3Mjc3MTQ4>
.
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
NAML 
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-return-early-from-a-direct-subroute-tp5780262p5780330.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message