You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by daytaa <na...@macquarie.com> on 2010/05/04 10:00:55 UTC

Reading from a VM queue

Hi,

I want to try and read (pop) a bulk set of messages from a VM component
queue into a list of sorts that I can pass into a bean method, dynamically
create some SQL and then call my data source. 

Really I want to do two things:
1. In the first route shown below I want to keep the original entity object
PatsTofOrderEntity right the way through my different routes and contexts
2. I want to use a timer to periodically get a bulk list of entries from the
final queue and then do some transformations and create some dynamic SQL to
then save it to data store. This queue should be created/added to in the
final camel context shown below and should save the original
PATSordereventEntity object rather than the OrderEventDTO.


Im using Spring DSL:.

<camelContext id="patsOrderEntityPoll"
xmlns="http://camel.apache.org/schema/spring">
....
<route id="pollPatsOrderTable" startupOrder="5" shutdownRoute="Defer">
	<from
uri="jpa:com.macquarie.ficc.futexe.bel.entity.pats.PatsTofOrderEntity?consumer.namedQuery=pollTofOrderRecords&amp;consumeDelete=false&amp;delay=20000&amp;consumer.useFixedDelay=true"
/>
	<convertBodyTo
type="com.macquarie.ficc.futexe.bel.entity.pats.PatsTofOrderEntity" />
	<to
uri="vm:patsTransformationOrder?size=500000&amp;timeout=1000000&amp;concurrentConsumers=50"
/>
</route>
...
</camelContext>



<camelContext id="patsOrderTransformerRoute"
xmlns="http://camel.apache.org/schema/spring">
...
 <route id="transformPatsOrderRoute" startupOrder="3" shutdownRoute="Defer">
	<from
uri="vm:patsTransformationOrder?size=500000&amp;timeout=1000000&amp;concurrentConsumers=50"
/>
	<to uri="bean:patsTofTransformerBean?method=transformPatsTofOrder" />
	<convertBodyTo type="com.macquarie.ficc.futexe.bel.dto.OrderEventDTO" />
	<to
uri="vm:storeNewEntity?size=1000000&amp;timeout=1000000&amp;concurrentConsumers=100"></to>
 </route>
...
</camelContext>



<camelContext id="storeNewOrderEventEntity"
xmlns="http://camel.apache.org/schema/spring">
...
 <route id="persistNewOrderEvent" startupOrder="1" shutdownRoute="Defer">
	<from
uri="vm:storeNewEntity?size=1000000&amp;timeout=1000000&amp;concurrentConsumers=100"
/>
	<to uri="bean:saveOrderEventRepository?method=saveNewOrderEvent" />
        <add to another queue here - pass in the original entity object some
how use a timer/>
 </route>
...
</camelContext>



...
 <route id="some new route using a timer and taking a bulk set of the
original entity objects and passing them to a bean to make a dynamicSQL
query>
   <from uri="timer:xxx">
   <read from ? read from the queue in the above route>
   <to uri"bean to make dynamic SQL and save entity object">
 </route>
...
</camelContext>

Any help would be greatly appreciated.

Thanks. 
-- 
View this message in context: http://old.nabble.com/Reading-from-a-VM-queue-tp28444281p28444281.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Reading from a VM queue

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Take a look at these EIP patterns

http://camel.apache.org/content-enricher.html
http://camel.apache.org/polling-consumer.html


On Tue, May 4, 2010 at 10:00 AM, daytaa <na...@macquarie.com> wrote:
>
> Hi,
>
> I want to try and read (pop) a bulk set of messages from a VM component
> queue into a list of sorts that I can pass into a bean method, dynamically
> create some SQL and then call my data source.
>
> Really I want to do two things:
> 1. In the first route shown below I want to keep the original entity object
> PatsTofOrderEntity right the way through my different routes and contexts
> 2. I want to use a timer to periodically get a bulk list of entries from the
> final queue and then do some transformations and create some dynamic SQL to
> then save it to data store. This queue should be created/added to in the
> final camel context shown below and should save the original
> PATSordereventEntity object rather than the OrderEventDTO.
>
>
> Im using Spring DSL:.
>
> <camelContext id="patsOrderEntityPoll"
> xmlns="http://camel.apache.org/schema/spring">
> ....
> <route id="pollPatsOrderTable" startupOrder="5" shutdownRoute="Defer">
>        <from
> uri="jpa:com.macquarie.ficc.futexe.bel.entity.pats.PatsTofOrderEntity?consumer.namedQuery=pollTofOrderRecords&amp;consumeDelete=false&amp;delay=20000&amp;consumer.useFixedDelay=true"
> />
>        <convertBodyTo
> type="com.macquarie.ficc.futexe.bel.entity.pats.PatsTofOrderEntity" />
>        <to
> uri="vm:patsTransformationOrder?size=500000&amp;timeout=1000000&amp;concurrentConsumers=50"
> />
> </route>
> ...
> </camelContext>
>
>
>
> <camelContext id="patsOrderTransformerRoute"
> xmlns="http://camel.apache.org/schema/spring">
> ...
>  <route id="transformPatsOrderRoute" startupOrder="3" shutdownRoute="Defer">
>        <from
> uri="vm:patsTransformationOrder?size=500000&amp;timeout=1000000&amp;concurrentConsumers=50"
> />
>        <to uri="bean:patsTofTransformerBean?method=transformPatsTofOrder" />
>        <convertBodyTo type="com.macquarie.ficc.futexe.bel.dto.OrderEventDTO" />
>        <to
> uri="vm:storeNewEntity?size=1000000&amp;timeout=1000000&amp;concurrentConsumers=100"></to>
>  </route>
> ...
> </camelContext>
>
>
>
> <camelContext id="storeNewOrderEventEntity"
> xmlns="http://camel.apache.org/schema/spring">
> ...
>  <route id="persistNewOrderEvent" startupOrder="1" shutdownRoute="Defer">
>        <from
> uri="vm:storeNewEntity?size=1000000&amp;timeout=1000000&amp;concurrentConsumers=100"
> />
>        <to uri="bean:saveOrderEventRepository?method=saveNewOrderEvent" />
>        <add to another queue here - pass in the original entity object some
> how use a timer/>
>  </route>
> ...
> </camelContext>
>
>
>
> ...
>  <route id="some new route using a timer and taking a bulk set of the
> original entity objects and passing them to a bean to make a dynamicSQL
> query>
>   <from uri="timer:xxx">
>   <read from ? read from the queue in the above route>
>   <to uri"bean to make dynamic SQL and save entity object">
>  </route>
> ...
> </camelContext>
>
> Any help would be greatly appreciated.
>
> Thanks.
> --
> View this message in context: http://old.nabble.com/Reading-from-a-VM-queue-tp28444281p28444281.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus