On Tue, Mar 2, 2010 at 7:41 AM, vcheruvu <[email protected]> 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 <[email protected]> >> 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&consumeDelete=false&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&consumeDelete=false&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 <[email protected]> >>>> 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&consumeDelete=false&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
