Route Dependency in XML DSL

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

Route Dependency in XML DSL

Gershaw, Geoffrey
Hello Camel Riders,

 

I have a route that I would like to start once another route is
finished.  I know I could change the jpa component into a custom bean,
but I want to do it the camel way J. I would essentially like to start
Route B From A.  IF they both start at the same time, the world may end
J

 

Thanks

<route id ="A">                

                <from uri="quickfix:config" />

                                <!-- On login, create MD Request -->

                                <filter>

                                <simple>${header.EventCategory} ==
'SessionLogon'</simple>


                </filter>

</route>

 

<route id="B">

                <from
uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a
pp.sql.included.cds}}" />

                                <bean ref="SecDefinitionFactory"
method="create"/>

                                <bean ref="MarketDataRequestFactory"
method="create"/>

<to uri="quickfix:config?....." />

</route>                  

Geoffrey A Gershaw

CREDIT SUISSE

Information Technology | Credit eTrading Development, KFVB 525

7033 Louis Stephens Drive | 27560 Research Triangle Park | United States

Phone +1 919 994 6412

[hidden email] | www.credit-suisse.com
<http://www.credit-suisse.com/>

 


===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
===============================================================================

Reply | Threaded
Open this post in threaded view
|

Re: Route Dependency in XML DSL

bibryam
Hi Geoffrey,

what do you mean by "route is finished" ?
Do you want to call route B at the end of rotue A?

Bilgin

On 14 January 2013 14:58, Gershaw, Geoffrey
<[hidden email]> wrote:
> Geoffrey
Reply | Threaded
Open this post in threaded view
|

RE: Route Dependency in XML DSL

Gershaw, Geoffrey
Yes, route a to call route b. I don't think it can be using the direct
component. I need the from of route b to use the jpa component.

<route id ="A">                
                <from uri="quickfix:config" />
                                <!-- On login, create MD Request -->
                                <filter>
                                <simple>${header.EventCategory} ==
'SessionLogon'</simple>

                </filter>
</route>

<route id="B">
                <from
uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a
pp.sql.included.cds}}" />
                                <bean ref="SecDefinitionFactory"
method="create"/>
                                <bean ref="MarketDataRequestFactory"
method="create"/>
<to uri="quickfix:config?....." />
</route>                  

Geoffrey A Gershaw
Credit eTrading Development
+1 919 994 6412 (*102 6412)

-----Original Message-----
From: Bilgin Ibryam [mailto:[hidden email]]
Sent: Monday, January 14, 2013 11:17 AM
To: [hidden email]
Subject: Re: Route Dependency in XML DSL

Hi Geoffrey,

what do you mean by "route is finished" ?
Do you want to call route B at the end of rotue A?

Bilgin

On 14 January 2013 14:58, Gershaw, Geoffrey
<[hidden email]> wrote:
> Geoffrey

===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
===============================================================================

Reply | Threaded
Open this post in threaded view
|

RE: Route Dependency in XML DSL

Gershaw, Geoffrey
In reply to this post by bibryam
Actually,

I should clarify, I don't want route B to start before route A is
finished. If Route B starts before Route A exits,  Route B will send
msgs to quickfix before quickfix is finished logging in.  Since Route B
has a JPA component as the from endpoint, as soon as its started, it
will start creating exchanges.

Therefore, I don't think it should start till A finishes. Unless you
could use some type of locking Mechanism.

-----Original Message-----
From: Gershaw, Geoffrey
Sent: Monday, January 14, 2013 12:40 PM
To: [hidden email]
Subject: RE: Route Dependency in XML DSL

Yes, route a to call route b. I don't think it can be using the direct
component. I need the from of route b to use the jpa component.

<route id ="A">                
                <from uri="quickfix:config" />
                                <!-- On login, create MD Request -->
                                <filter>
                                <simple>${header.EventCategory} ==
'SessionLogon'</simple>

                </filter>
</route>

<route id="B">
                <from
uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a
pp.sql.included.cds}}" />
                                <bean ref="SecDefinitionFactory"
method="create"/>
                                <bean ref="MarketDataRequestFactory"
method="create"/>
<to uri="quickfix:config?....." />
</route>                  

Geoffrey A Gershaw
Credit eTrading Development
+1 919 994 6412 (*102 6412)

-----Original Message-----
From: Bilgin Ibryam [mailto:[hidden email]]
Sent: Monday, January 14, 2013 11:17 AM
To: [hidden email]
Subject: Re: Route Dependency in XML DSL

Hi Geoffrey,

what do you mean by "route is finished" ?
Do you want to call route B at the end of rotue A?

Bilgin

On 14 January 2013 14:58, Gershaw, Geoffrey
<[hidden email]> wrote:
> Geoffrey

===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
===============================================================================

Reply | Threaded
Open this post in threaded view
|

Re: Route Dependency in XML DSL

Maruan Sahyoun
Hi,

there is a sample how to stop a route from another one - can also be used for starting.

https://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Maruan Sahyoun

Am 14.01.2013 um 18:59 schrieb "Gershaw, Geoffrey" <[hidden email]>:

> Actually,
>
> I should clarify, I don't want route B to start before route A is
> finished. If Route B starts before Route A exits,  Route B will send
> msgs to quickfix before quickfix is finished logging in.  Since Route B
> has a JPA component as the from endpoint, as soon as its started, it
> will start creating exchanges.
>
> Therefore, I don't think it should start till A finishes. Unless you
> could use some type of locking Mechanism.
>
> -----Original Message-----
> From: Gershaw, Geoffrey
> Sent: Monday, January 14, 2013 12:40 PM
> To: [hidden email]
> Subject: RE: Route Dependency in XML DSL
>
> Yes, route a to call route b. I don't think it can be using the direct
> component. I need the from of route b to use the jpa component.
>
> <route id ="A">                
>                <from uri="quickfix:config" />
>                                <!-- On login, create MD Request -->
>                                <filter>
>                                <simple>${header.EventCategory} ==
> 'SessionLogon'</simple>
>
>                </filter>
> </route>
>
> <route id="B">
>                <from
> uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a
> pp.sql.included.cds}}" />
>                                <bean ref="SecDefinitionFactory"
> method="create"/>
>                                <bean ref="MarketDataRequestFactory"
> method="create"/>
> <to uri="quickfix:config?....." />
> </route>                  
>
> Geoffrey A Gershaw
> Credit eTrading Development
> +1 919 994 6412 (*102 6412)
>
> -----Original Message-----
> From: Bilgin Ibryam [mailto:[hidden email]]
> Sent: Monday, January 14, 2013 11:17 AM
> To: [hidden email]
> Subject: Re: Route Dependency in XML DSL
>
> Hi Geoffrey,
>
> what do you mean by "route is finished" ?
> Do you want to call route B at the end of rotue A?
>
> Bilgin
>
> On 14 January 2013 14:58, Gershaw, Geoffrey
> <[hidden email]> wrote:
>> Geoffrey
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
> ===============================================================================
>

Reply | Threaded
Open this post in threaded view
|

RE: Route Dependency in XML DSL

Gershaw, Geoffrey
Thanks for responding. Unfortunately, this doesn't show any XML DSL
example. Is it possible in XML?


-----Original Message-----
From: Maruan Sahyoun [mailto:[hidden email]]
Sent: Monday, January 14, 2013 1:49 PM
To: [hidden email]
Subject: Re: Route Dependency in XML DSL

Hi,

there is a sample how to stop a route from another one - can also be
used for starting.

https://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Maruan Sahyoun

Am 14.01.2013 um 18:59 schrieb "Gershaw, Geoffrey"
<[hidden email]>:

> Actually,
>
> I should clarify, I don't want route B to start before route A is
> finished. If Route B starts before Route A exits,  Route B will send
> msgs to quickfix before quickfix is finished logging in.  Since Route
B

> has a JPA component as the from endpoint, as soon as its started, it
> will start creating exchanges.
>
> Therefore, I don't think it should start till A finishes. Unless you
> could use some type of locking Mechanism.
>
> -----Original Message-----
> From: Gershaw, Geoffrey
> Sent: Monday, January 14, 2013 12:40 PM
> To: [hidden email]
> Subject: RE: Route Dependency in XML DSL
>
> Yes, route a to call route b. I don't think it can be using the direct
> component. I need the from of route b to use the jpa component.
>
> <route id ="A">                
>                <from uri="quickfix:config" />
>                                <!-- On login, create MD Request -->
>                                <filter>
>                                <simple>${header.EventCategory} ==
> 'SessionLogon'</simple>
>
>                </filter>
> </route>
>
> <route id="B">
>                <from
>
uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a

> pp.sql.included.cds}}" />
>                                <bean ref="SecDefinitionFactory"
> method="create"/>
>                                <bean ref="MarketDataRequestFactory"
> method="create"/>
> <to uri="quickfix:config?....." />
> </route>                  
>
> Geoffrey A Gershaw
> Credit eTrading Development
> +1 919 994 6412 (*102 6412)
>
> -----Original Message-----
> From: Bilgin Ibryam [mailto:[hidden email]]
> Sent: Monday, January 14, 2013 11:17 AM
> To: [hidden email]
> Subject: Re: Route Dependency in XML DSL
>
> Hi Geoffrey,
>
> what do you mean by "route is finished" ?
> Do you want to call route B at the end of rotue A?
>
> Bilgin
>
> On 14 January 2013 14:58, Gershaw, Geoffrey
> <[hidden email]> wrote:
>> Geoffrey
>
>
========================================================================
=======
> Please access the attached hyperlink for an important electronic
communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
>
========================================================================
=======
>


===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
===============================================================================

Reply | Threaded
Open this post in threaded view
|

Re: Route Dependency in XML DSL

Łukasz Dywicki
Hey Gershaw,
You have couple options here:
1) use specific route order to keep precedence. Camel starts routes from first to last
2) disable auto startup of routes by using autoStartup=false for route element
3) use initial delay for consumers to hang first poll of the resource - for JPA it will be consumer.initialDelay

Cheers,
--
Łukasz Dywicki
[hidden email]
Twitter: ldywicki
Blog: http://dywicki.pl
Code-House - http://code-house.org

Wiadomość napisana przez Gershaw, Geoffrey w dniu 14 sty 2013, o godz. 19:55:

> Thanks for responding. Unfortunately, this doesn't show any XML DSL
> example. Is it possible in XML?
>
>
> -----Original Message-----
> From: Maruan Sahyoun [mailto:[hidden email]]
> Sent: Monday, January 14, 2013 1:49 PM
> To: [hidden email]
> Subject: Re: Route Dependency in XML DSL
>
> Hi,
>
> there is a sample how to stop a route from another one - can also be
> used for starting.
>
> https://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>
> Maruan Sahyoun
>
> Am 14.01.2013 um 18:59 schrieb "Gershaw, Geoffrey"
> <[hidden email]>:
>
>> Actually,
>>
>> I should clarify, I don't want route B to start before route A is
>> finished. If Route B starts before Route A exits,  Route B will send
>> msgs to quickfix before quickfix is finished logging in.  Since Route
> B
>> has a JPA component as the from endpoint, as soon as its started, it
>> will start creating exchanges.
>>
>> Therefore, I don't think it should start till A finishes. Unless you
>> could use some type of locking Mechanism.
>>
>> -----Original Message-----
>> From: Gershaw, Geoffrey
>> Sent: Monday, January 14, 2013 12:40 PM
>> To: [hidden email]
>> Subject: RE: Route Dependency in XML DSL
>>
>> Yes, route a to call route b. I don't think it can be using the direct
>> component. I need the from of route b to use the jpa component.
>>
>> <route id ="A">                
>>               <from uri="quickfix:config" />
>>                               <!-- On login, create MD Request -->
>>                               <filter>
>>                               <simple>${header.EventCategory} ==
>> 'SessionLogon'</simple>
>>
>>               </filter>
>> </route>
>>
>> <route id="B">
>>               <from
>>
> uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a
>> pp.sql.included.cds}}" />
>>                               <bean ref="SecDefinitionFactory"
>> method="create"/>
>>                               <bean ref="MarketDataRequestFactory"
>> method="create"/>
>> <to uri="quickfix:config?....." />
>> </route>                  
>>
>> Geoffrey A Gershaw
>> Credit eTrading Development
>> +1 919 994 6412 (*102 6412)
>>
>> -----Original Message-----
>> From: Bilgin Ibryam [mailto:[hidden email]]
>> Sent: Monday, January 14, 2013 11:17 AM
>> To: [hidden email]
>> Subject: Re: Route Dependency in XML DSL
>>
>> Hi Geoffrey,
>>
>> what do you mean by "route is finished" ?
>> Do you want to call route B at the end of rotue A?
>>
>> Bilgin
>>
>> On 14 January 2013 14:58, Gershaw, Geoffrey
>> <[hidden email]> wrote:
>>> Geoffrey
>>
>>
> ========================================================================
> =======
>> Please access the attached hyperlink for an important electronic
> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
>>
> ========================================================================
> =======
>>
>
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
> ===============================================================================
>

Reply | Threaded
Open this post in threaded view
|

Re: Route Dependency in XML DSL

Maruan Sahyoun
In reply to this post by Gershaw, Geoffrey
sorry - I missed the XML prerequisite.

would it be an option to connect route A to B using a direct endpoint e.g.:


<route id ="A">
        <from uri="quickfix:config" />
                 <!-- On login, create MD Request -->
                        <filter>
                                <simple>${header.EventCategory} =='SessionLogon'</simple>
                       </filter>
        <to uri="direct-vm:route-b"/>
</route>


<route id="B">
        <from uri="direct-vm:route-b"/>
        <to uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{app.sql.included.cds}}" />
                <bean ref="SecDefinitionFactory" method="create"/>
                <bean ref="MarketDataRequestFactory" method="create"/>
        <to uri="quickfix:config?....." />
</route>                  


Maruan Sahyoun

Am 14.01.2013 um 19:55 schrieb "Gershaw, Geoffrey" <[hidden email]>:

> Thanks for responding. Unfortunately, this doesn't show any XML DSL
> example. Is it possible in XML?
>
>
> -----Original Message-----
> From: Maruan Sahyoun [mailto:[hidden email]]
> Sent: Monday, January 14, 2013 1:49 PM
> To: [hidden email]
> Subject: Re: Route Dependency in XML DSL
>
> Hi,
>
> there is a sample how to stop a route from another one - can also be
> used for starting.
>
> https://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>
> Maruan Sahyoun
>
> Am 14.01.2013 um 18:59 schrieb "Gershaw, Geoffrey"
> <[hidden email]>:
>
>> Actually,
>>
>> I should clarify, I don't want route B to start before route A is
>> finished. If Route B starts before Route A exits,  Route B will send
>> msgs to quickfix before quickfix is finished logging in.  Since Route
> B
>> has a JPA component as the from endpoint, as soon as its started, it
>> will start creating exchanges.
>>
>> Therefore, I don't think it should start till A finishes. Unless you
>> could use some type of locking Mechanism.
>>
>> -----Original Message-----
>> From: Gershaw, Geoffrey
>> Sent: Monday, January 14, 2013 12:40 PM
>> To: [hidden email]
>> Subject: RE: Route Dependency in XML DSL
>>
>> Yes, route a to call route b. I don't think it can be using the direct
>> component. I need the from of route b to use the jpa component.
>>
>> <route id ="A">                
>>               <from uri="quickfix:config" />
>>                               <!-- On login, create MD Request -->
>>                               <filter>
>>                               <simple>${header.EventCategory} ==
>> 'SessionLogon'</simple>
>>
>>               </filter>
>> </route>
>>
>> <route id="B">
>>               <from
>>
> uri="jpa://{{app.jpa.cdx.entity}}?consumeDelete=false&consumer.query={{a
>> pp.sql.included.cds}}" />
>>                               <bean ref="SecDefinitionFactory"
>> method="create"/>
>>                               <bean ref="MarketDataRequestFactory"
>> method="create"/>
>> <to uri="quickfix:config?....." />
>> </route>                  
>>
>> Geoffrey A Gershaw
>> Credit eTrading Development
>> +1 919 994 6412 (*102 6412)
>>
>> -----Original Message-----
>> From: Bilgin Ibryam [mailto:[hidden email]]
>> Sent: Monday, January 14, 2013 11:17 AM
>> To: [hidden email]
>> Subject: Re: Route Dependency in XML DSL
>>
>> Hi Geoffrey,
>>
>> what do you mean by "route is finished" ?
>> Do you want to call route B at the end of rotue A?
>>
>> Bilgin
>>
>> On 14 January 2013 14:58, Gershaw, Geoffrey
>> <[hidden email]> wrote:
>>> Geoffrey
>>
>>
> ========================================================================
> =======
>> Please access the attached hyperlink for an important electronic
> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
>>
> ========================================================================
> =======
>>
>
>
> ===============================================================================
> Please access the attached hyperlink for an important electronic communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
> ===============================================================================
>