You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vcheruvu <vi...@macquarie.com> on 2010/03/01 08:05:10 UTC

Multiple JPA Consumers

How can i define multiple JPA consumers in CAMEL? I have managed to create
another camel context which is duplicate of below camelContext segment
except id is named as camel2.  This duplicate segment worked but i like to
have a way where I can  define number of consumers without having duplicate
the camelContext code. I looked at Seda and VM but didn't know how to define
"from".  Can you please advise how I can add multiple consumers for JPA in
Camel? Thanks in advance.
 
	<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    	<package>com.mbl</package>
    	<jmxAgent id="agent" createConnector="true" /> 
		<route>
			<from
uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
			<convertBodyTo type="com.MyEntity"/>
			<to uri="bean:transformerBean?method=transformOrder"/>
			
		</route>
   </camelContext>

<bean id = "transformerBean" class ="com.transformation.OrderTransformation"
/>


Kind regards,
-Vid-
-- 
View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple JPA Consumers

Posted by vcheruvu <vi...@macquarie.com>.
 I will use DSL and get away from Spring config.  I am not fussy with how I
define the route in DSL or Spring config. Thanks for quick response mate..


Claus Ibsen-2 wrote:
> 
> On Tue, Mar 2, 2010 at 7:41 AM, vcheruvu <vi...@macquarie.com>
> wrote:
>>
>> can jdbc or ibatis endpoint have multiple consumers from a table rather
>> than
>> creating another same route in the context file? Why isn't there multiple
>> consumer concept in Camel that read in from a table? I am thinking that
>> this
>> would be popular requirement that most people could face when they want
>> to
>> maximize throughput.
>>
> 
> Normally you would not have concurrent consumers on a JDBC table.
> Instead you would select data once, and then work on the ResultSet in
> parallel.
> You can do this using the threads() DSL in Camel.
> 
> 
> http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-concurrency-with.html
> 
> 
> 
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Mon, Mar 1, 2010 at 11:43 PM, vcheruvu <vi...@macquarie.com>
>>> wrote:
>>>>
>>>> Apologies, I did not clearly explain in the previous post.
>>>>
>>>> Basically I am trying to see how can I can have  multiple consumers at
>>>> same
>>>> JPA endpoint.  So, multiple consumers will poll the table where each
>>>> consumer will get next 100 records.   I am treating the table as a
>>>> queue
>>>> using readpast select query and update rows that are processed.
>>>>
>>>> So how can I achieve concurrent consumers on this endpoint
>>>>
>>>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>>>
>>>
>>> The JPA component does not support concurrent consumers out of the box.
>>>
>>> You can define multiple routes in the camel context and thus still
>>> have concurrent consumers.
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I assume you are talking about having concurrent JPA consumers on the
>>>>> same JPA endpoint?
>>>>>
>>>>> eg you want this one:
>>>>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>>>>
>>>>> To have concurrent threads processing it?
>>>>> If not what are you talking about?
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Mar 1, 2010 at 8:05 AM, vcheruvu <vi...@macquarie.com>
>>>>> wrote:
>>>>>>
>>>>>> How can i define multiple JPA consumers in CAMEL? I have managed to
>>>>>> create
>>>>>> another camel context which is duplicate of below camelContext
>>>>>> segment
>>>>>> except id is named as camel2.  This duplicate segment worked but i
>>>>>> like
>>>>>> to
>>>>>> have a way where I can  define number of consumers without having
>>>>>> duplicate
>>>>>> the camelContext code. I looked at Seda and VM but didn't know how to
>>>>>> define
>>>>>> "from".  Can you please advise how I can add multiple consumers for
>>>>>> JPA
>>>>>> in
>>>>>> Camel? Thanks in advance.
>>>>>>
>>>>>>        <camelContext id="camel"
>>>>>> xmlns="http://camel.apache.org/schema/spring">
>>>>>>        <package>com.mbl</package>
>>>>>>        <jmxAgent id="agent" createConnector="true" />
>>>>>>                <route>
>>>>>>                        <from
>>>>>> uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
>>>>>>                        <convertBodyTo type="com.MyEntity"/>
>>>>>>                        <to
>>>>>> uri="bean:transformerBean?method=transformOrder"/>
>>>>>>
>>>>>>                </route>
>>>>>>   </camelContext>
>>>>>>
>>>>>> <bean id = "transformerBean" class
>>>>>> ="com.transformation.OrderTransformation"
>>>>>> />
>>>>>>
>>>>>>
>>>>>> Kind regards,
>>>>>> -Vid-
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.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
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27750074.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
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27752617.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
> 
> 

-- 
View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27752766.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple JPA Consumers

Posted by MSE <se...@yahoo.fr>.
hi, 
i am new in camel and i have a problem to create a mutli processing JPA
route on a table:
my configuration is seems to be correct but no multiprocessing occur on my
bean AcquisitionMvibsComponent ... any suggestion would be appreciate

here is my configuration


<threadPool id="myPool" threadName="MPH" poolSize="16"
			maxPoolSize="30" maxQueueSize="1000" />

<route>
		<from
			
uri="jpa://diamis.xpeach.acquisition.AcquisitionRequest?maximumResults=5&#38;consumer.namedQuery=acquisitionrequest&#38;consumer.delay=1000&#38;persistenceUnit=monitoringPU"
/>
			<transacted ref="required_new_database" />
			<camel:doTry>
				
				
				<threads executorServiceRef="myPool">
					<bean ref="AcquisitionMvibsComponent" method="process" />
				</threads>
				
				
				<to uri="MQconnection:queue:DISTRIBUTION.DISPATCHER" />
				<camel:doCatch>
					<exception>diamis.xpeach.exception.XPeachException</exception>
					<bean ref="ExceptionToStringTransformer" method="doTransform"></bean>
					<to uri="MQconnection:queue:ERROR"></to>
				</camel:doCatch>
			</camel:doTry>
		</route>



--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-JPA-Consumers-tp472290p5716287.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple JPA Consumers

Posted by vcheruvu <v_...@hotmail.com>.
I have solved your issue by having stored procedure to return the records.
This stored procedure use select for update with row lock. When JPA consumer
calls the stored procedures it will guarantee to call next set of records
rather than the records that have been locked by other JPA consumer. It is
messy to get application to manage this. This way, it will also  to allow  3
or 4 or n number of consumers..

In the entity class, i have used Hibernate  Query hint. ( We use Sybase
database)

@NamedNativeQueries({ @NamedNativeQuery(name="pollRecords", query="SET
CHAINED OFF exec poll_record_process 2500",
		resultClass= MyEntity.class,
		hints={@QueryHint(name="org.hibernate.callable", value="true")}),
	@NamedNativeQuery(name="pollRecordsTest", query="SET CHAINED OFF exec
poll_record_procTest 10",
			resultClass= MyEntity.class,
			hints={@QueryHint(name="org.hibernate.callable", value="true")})	
})

-- 
View this message in context: http://camel.465427.n5.nabble.com/Multiple-JPA-Consumers-tp472290p3266637.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple JPA Consumers

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 2, 2010 at 7:41 AM, vcheruvu <vi...@macquarie.com> wrote:
>
> can jdbc or ibatis endpoint have multiple consumers from a table rather than
> creating another same route in the context file? Why isn't there multiple
> consumer concept in Camel that read in from a table? I am thinking that this
> would be popular requirement that most people could face when they want to
> maximize throughput.
>

Normally you would not have concurrent consumers on a JDBC table.
Instead you would select data once, and then work on the ResultSet in
parallel.
You can do this using the threads() DSL in Camel.


http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-concurrency-with.html



>
> Claus Ibsen-2 wrote:
>>
>> On Mon, Mar 1, 2010 at 11:43 PM, vcheruvu <vi...@macquarie.com>
>> wrote:
>>>
>>> Apologies, I did not clearly explain in the previous post.
>>>
>>> Basically I am trying to see how can I can have  multiple consumers at
>>> same
>>> JPA endpoint.  So, multiple consumers will poll the table where each
>>> consumer will get next 100 records.   I am treating the table as a queue
>>> using readpast select query and update rows that are processed.
>>>
>>> So how can I achieve concurrent consumers on this endpoint
>>>
>>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>>
>>
>> The JPA component does not support concurrent consumers out of the box.
>>
>> You can define multiple routes in the camel context and thus still
>> have concurrent consumers.
>>
>>
>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> Hi
>>>>
>>>> I assume you are talking about having concurrent JPA consumers on the
>>>> same JPA endpoint?
>>>>
>>>> eg you want this one:
>>>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>>>
>>>> To have concurrent threads processing it?
>>>> If not what are you talking about?
>>>>
>>>>
>>>>
>>>> On Mon, Mar 1, 2010 at 8:05 AM, vcheruvu <vi...@macquarie.com>
>>>> wrote:
>>>>>
>>>>> How can i define multiple JPA consumers in CAMEL? I have managed to
>>>>> create
>>>>> another camel context which is duplicate of below camelContext segment
>>>>> except id is named as camel2.  This duplicate segment worked but i like
>>>>> to
>>>>> have a way where I can  define number of consumers without having
>>>>> duplicate
>>>>> the camelContext code. I looked at Seda and VM but didn't know how to
>>>>> define
>>>>> "from".  Can you please advise how I can add multiple consumers for JPA
>>>>> in
>>>>> Camel? Thanks in advance.
>>>>>
>>>>>        <camelContext id="camel"
>>>>> xmlns="http://camel.apache.org/schema/spring">
>>>>>        <package>com.mbl</package>
>>>>>        <jmxAgent id="agent" createConnector="true" />
>>>>>                <route>
>>>>>                        <from
>>>>> uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
>>>>>                        <convertBodyTo type="com.MyEntity"/>
>>>>>                        <to
>>>>> uri="bean:transformerBean?method=transformOrder"/>
>>>>>
>>>>>                </route>
>>>>>   </camelContext>
>>>>>
>>>>> <bean id = "transformerBean" class
>>>>> ="com.transformation.OrderTransformation"
>>>>> />
>>>>>
>>>>>
>>>>> Kind regards,
>>>>> -Vid-
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.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
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27750074.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
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27752617.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

Re: Multiple JPA Consumers

Posted by vcheruvu <vi...@macquarie.com>.
can jdbc or ibatis endpoint have multiple consumers from a table rather than
creating another same route in the context file? Why isn't there multiple
consumer concept in Camel that read in from a table? I am thinking that this 
would be popular requirement that most people could face when they want to
maximize throughput. 


Claus Ibsen-2 wrote:
> 
> On Mon, Mar 1, 2010 at 11:43 PM, vcheruvu <vi...@macquarie.com>
> wrote:
>>
>> Apologies, I did not clearly explain in the previous post.
>>
>> Basically I am trying to see how can I can have  multiple consumers at
>> same
>> JPA endpoint.  So, multiple consumers will poll the table where each
>> consumer will get next 100 records.   I am treating the table as a queue
>> using readpast select query and update rows that are processed.
>>
>> So how can I achieve concurrent consumers on this endpoint
>>
>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>
> 
> The JPA component does not support concurrent consumers out of the box.
> 
> You can define multiple routes in the camel context and thus still
> have concurrent consumers.
> 
> 
> 
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> I assume you are talking about having concurrent JPA consumers on the
>>> same JPA endpoint?
>>>
>>> eg you want this one:
>>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>>
>>> To have concurrent threads processing it?
>>> If not what are you talking about?
>>>
>>>
>>>
>>> On Mon, Mar 1, 2010 at 8:05 AM, vcheruvu <vi...@macquarie.com>
>>> wrote:
>>>>
>>>> How can i define multiple JPA consumers in CAMEL? I have managed to
>>>> create
>>>> another camel context which is duplicate of below camelContext segment
>>>> except id is named as camel2.  This duplicate segment worked but i like
>>>> to
>>>> have a way where I can  define number of consumers without having
>>>> duplicate
>>>> the camelContext code. I looked at Seda and VM but didn't know how to
>>>> define
>>>> "from".  Can you please advise how I can add multiple consumers for JPA
>>>> in
>>>> Camel? Thanks in advance.
>>>>
>>>>        <camelContext id="camel"
>>>> xmlns="http://camel.apache.org/schema/spring">
>>>>        <package>com.mbl</package>
>>>>        <jmxAgent id="agent" createConnector="true" />
>>>>                <route>
>>>>                        <from
>>>> uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
>>>>                        <convertBodyTo type="com.MyEntity"/>
>>>>                        <to
>>>> uri="bean:transformerBean?method=transformOrder"/>
>>>>
>>>>                </route>
>>>>   </camelContext>
>>>>
>>>> <bean id = "transformerBean" class
>>>> ="com.transformation.OrderTransformation"
>>>> />
>>>>
>>>>
>>>> Kind regards,
>>>> -Vid-
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.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
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27750074.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
> 
> 

-- 
View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27752617.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple JPA Consumers

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Mar 1, 2010 at 11:43 PM, vcheruvu <vi...@macquarie.com> wrote:
>
> Apologies, I did not clearly explain in the previous post.
>
> Basically I am trying to see how can I can have  multiple consumers at same
> JPA endpoint.  So, multiple consumers will poll the table where each
> consumer will get next 100 records.   I am treating the table as a queue
> using readpast select query and update rows that are processed.
>
> So how can I achieve concurrent consumers on this endpoint
>
> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>

The JPA component does not support concurrent consumers out of the box.

You can define multiple routes in the camel context and thus still
have concurrent consumers.



>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> I assume you are talking about having concurrent JPA consumers on the
>> same JPA endpoint?
>>
>> eg you want this one:
>> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
>>
>> To have concurrent threads processing it?
>> If not what are you talking about?
>>
>>
>>
>> On Mon, Mar 1, 2010 at 8:05 AM, vcheruvu <vi...@macquarie.com>
>> wrote:
>>>
>>> How can i define multiple JPA consumers in CAMEL? I have managed to
>>> create
>>> another camel context which is duplicate of below camelContext segment
>>> except id is named as camel2.  This duplicate segment worked but i like
>>> to
>>> have a way where I can  define number of consumers without having
>>> duplicate
>>> the camelContext code. I looked at Seda and VM but didn't know how to
>>> define
>>> "from".  Can you please advise how I can add multiple consumers for JPA
>>> in
>>> Camel? Thanks in advance.
>>>
>>>        <camelContext id="camel"
>>> xmlns="http://camel.apache.org/schema/spring">
>>>        <package>com.mbl</package>
>>>        <jmxAgent id="agent" createConnector="true" />
>>>                <route>
>>>                        <from
>>> uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
>>>                        <convertBodyTo type="com.MyEntity"/>
>>>                        <to
>>> uri="bean:transformerBean?method=transformOrder"/>
>>>
>>>                </route>
>>>   </camelContext>
>>>
>>> <bean id = "transformerBean" class
>>> ="com.transformation.OrderTransformation"
>>> />
>>>
>>>
>>> Kind regards,
>>> -Vid-
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.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
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27750074.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

Re: Multiple JPA Consumers

Posted by vcheruvu <vi...@macquarie.com>.
Apologies, I did not clearly explain in the previous post.

Basically I am trying to see how can I can have  multiple consumers at same
JPA endpoint.  So, multiple consumers will poll the table where each
consumer will get next 100 records.   I am treating the table as a queue
using readpast select query and update rows that are processed.

So how can I achieve concurrent consumers on this endpoint

jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000




Claus Ibsen-2 wrote:
> 
> Hi
> 
> I assume you are talking about having concurrent JPA consumers on the
> same JPA endpoint?
> 
> eg you want this one:
> jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000
> 
> To have concurrent threads processing it?
> If not what are you talking about?
> 
> 
> 
> On Mon, Mar 1, 2010 at 8:05 AM, vcheruvu <vi...@macquarie.com>
> wrote:
>>
>> How can i define multiple JPA consumers in CAMEL? I have managed to
>> create
>> another camel context which is duplicate of below camelContext segment
>> except id is named as camel2.  This duplicate segment worked but i like
>> to
>> have a way where I can  define number of consumers without having
>> duplicate
>> the camelContext code. I looked at Seda and VM but didn't know how to
>> define
>> "from".  Can you please advise how I can add multiple consumers for JPA
>> in
>> Camel? Thanks in advance.
>>
>>        <camelContext id="camel"
>> xmlns="http://camel.apache.org/schema/spring">
>>        <package>com.mbl</package>
>>        <jmxAgent id="agent" createConnector="true" />
>>                <route>
>>                        <from
>> uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
>>                        <convertBodyTo type="com.MyEntity"/>
>>                        <to
>> uri="bean:transformerBean?method=transformOrder"/>
>>
>>                </route>
>>   </camelContext>
>>
>> <bean id = "transformerBean" class
>> ="com.transformation.OrderTransformation"
>> />
>>
>>
>> Kind regards,
>> -Vid-
>> --
>> View this message in context:
>> http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.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
> 
> 

-- 
View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27750074.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple JPA Consumers

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

I assume you are talking about having concurrent JPA consumers on the
same JPA endpoint?

eg you want this one:
jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000

To have concurrent threads processing it?
If not what are you talking about?



On Mon, Mar 1, 2010 at 8:05 AM, vcheruvu <vi...@macquarie.com> wrote:
>
> How can i define multiple JPA consumers in CAMEL? I have managed to create
> another camel context which is duplicate of below camelContext segment
> except id is named as camel2.  This duplicate segment worked but i like to
> have a way where I can  define number of consumers without having duplicate
> the camelContext code. I looked at Seda and VM but didn't know how to define
> "from".  Can you please advise how I can add multiple consumers for JPA in
> Camel? Thanks in advance.
>
>        <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>        <package>com.mbl</package>
>        <jmxAgent id="agent" createConnector="true" />
>                <route>
>                        <from
> uri="jpa:com.MyEntity?consumer.namedQuery=pollRecords&amp;consumeDelete=false&amp;delay=3000"/>
>                        <convertBodyTo type="com.MyEntity"/>
>                        <to uri="bean:transformerBean?method=transformOrder"/>
>
>                </route>
>   </camelContext>
>
> <bean id = "transformerBean" class ="com.transformation.OrderTransformation"
> />
>
>
> Kind regards,
> -Vid-
> --
> View this message in context: http://old.nabble.com/Multiple-JPA-Consumers-tp27740630p27740630.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