On Fri, Jan 18, 2013 at 9:09 AM, Gershaw, Geoffrey <geoffrey.gers...@credit-suisse.com> wrote: > Hello, > > Thanks for your reply. This strategy appears not to work. Using the jpa > component in the to endpoint tries to store the entity in the message > body into the db. This results in a null pointer. I am trying to > retrieve entities from the db using jpa. > > So once route A completes, route B should use the jpa component to get > the entities from the db. > > Any other ideas would be appreciated. I might have to write a custom > bean, but I thought Camel could handle this. Seems like a use case. > > > <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={{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: Maruan Sahyoun [mailto:sahy...@fileaffairs.de] > Sent: Monday, January 14, 2013 3:08 PM > To: users@camel.apache.org > Subject: Re: Route Dependency in XML DSL > > 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={{a > pp.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" > <geoffrey.gers...@credit-suisse.com>: > >> Thanks for responding. Unfortunately, this doesn't show any XML DSL >> example. Is it possible in XML? >> >> >> -----Original Message----- >> From: Maruan Sahyoun [mailto:sahy...@fileaffairs.de] >> Sent: Monday, January 14, 2013 1:49 PM >> To: users@camel.apache.org >> 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" >> <geoffrey.gers...@credit-suisse.com>: >> >>> 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: users@camel.apache.org >>> 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:bibr...@gmail.com] >>> Sent: Monday, January 14, 2013 11:17 AM >>> To: users@camel.apache.org >>> 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 >>> <geoffrey.gers...@credit-suisse.com> wrote: >>>> Geoffrey >>>
I have the same use case as you - upon completion of route 'A', signal route 'B' to perform a one-time read of the DB. (by "one-time", I mean once per-signal from route 'A'). for the custom poller see my response to your other email with subject "JPA Component behavior", which has the custom poll strategy attached. Your XML example is attached. -Chris
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:jboss="http://www.jboss.org/schema/spring" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.jboss.org/schema/snowdrop http://www.jboss.org/schema/snowdrop/snowdrop.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"/> <bean id="oneshotPoller" class="com.starclass.camel.OneShotPollingConsumerStrategy" p:defaultRouteId="B" \> <camelContext id="adapt.axioma" xmlns="http://camel.apache.org/schema/spring"> <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"/> <bean ref="oneshotPoller" method="resumeJpaConsumer"/><!-- this will resume/start the JPA consumer --> </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}}&pollStrategy=#oneshotPoller&startScheduler=false" /> <bean ref="SecDefinitionFactory" method="create"/> <bean ref="MarketDataRequestFactory" method="create"/> <to uri="quickfix:config?....." /> </route> </camelContext> </beans>