You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cgiera <ch...@mic-cust.com> on 2013/07/25 13:22:18 UTC

Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Hello,

I have to write a new Camel component which should have the similar behavior
like the JmsComponent but I'm not allowed to use Jms(due customer
restrictions).

I want to use as much functionallity as possible from the standard
implementations in camel.
So I decided to extend from the DefaultScheduledPollEndpoint/Consumer to get
all the inital delay, delay... stuff. 
In the poll method I just use the JdbcTemplate to call a pl/sql procedure
which dequeues the data.

What is missing now is the MultiConsumer support so I can provide the
concurrentConsumer parameters  we use in our JMS routes nowadays.

I have looked through the existing components and there are only jms, seda
and timer which support this feature. Non of them does fit my requirements
exactly(or I don't understand it enough).

Sorry if I've missed something and it is really easy, thanks for your time.

kind regards,
Christoph




--
View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by cgiera <ch...@mic-cust.com>.
Hello,

I think I got it.
I didn't know that it is possible to add the same Runnable to the
ExecuterService multiple times.



Thx for your help.

kind regards,
Christoph



--
View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266p5736484.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by cgiera <ch...@mic-cust.com>.
Yes, that's a good hint.
>From your experience is it a viable way to implement it like this?


It looks strange to me to add new consumers in a consumer class.

Maybe there is some impact on the general functionallity if I don't create
consumers with the endpoint.createConsumer method or something like that



--
View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266p5736434.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by Claus Ibsen <cl...@gmail.com>.
ScheduledPollConsumer is by default a single threaded consumer.

You would need to schedule more tasks yourself, see the startScheduler
method in ScheduledPollConsumer.
You can override that and schedule more tasks.

By default only 1 task is scheduled.

On Mon, Jul 29, 2013 at 2:52 PM, cgiera <ch...@mic-cust.com> wrote:
> Yes, but I haven't found an easy way to add my consumer(when I extend from
> ScheduledPollConsumer it is a Runnable) to the underlying executerService. I
> think there should be an easy way but I haven't found it.
>
> kind regards,
> Christoph
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266p5736431.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by cgiera <ch...@mic-cust.com>.
Yes, but I haven't found an easy way to add my consumer(when I extend from
ScheduledPollConsumer it is a Runnable) to the underlying executerService. I
think there should be an easy way but I haven't found it.

kind regards,
Christoph



--
View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266p5736431.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by Claus Ibsen <cl...@gmail.com>.
You have to implement this logic yourself in your custom component.

On Mon, Jul 29, 2013 at 1:46 PM, cgiera <ch...@mic-cust.com> wrote:
> Claus Ibsen-2 wrote
>> They are not the same. The former is for allowing 2+ routes with the
>> same endpoint, eg multiple consumers, eg:
>>
>> from A
>>   to B
>>
>> from A
>>   to C
>>
>>
>> concurrentConsumers is for the same consumer, eg
>>
>> from A concurrentConsumers = 10
>>   to B
>>
>>> I have looked through the existing components and there are only jms,
>>> seda
>>> and timer which support this feature. Non of them does fit my
>>> requirements
>>> exactly(or I don't understand it enough).
>>>
>>> Sorry if I've missed something and it is really easy, thanks for your
>>> time.
>>>
>>> kind regards,
>>> Christoph
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email:
>
>> cibsen@
>
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>
> Hello,
>
> yes I want to implement
>
> from A concurrentConsumers = 10
>   to B
>
> but there I'm missing the step where I can easily create/register more than
> 1 consumer.
>
> kind regards,
> Christoph
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266p5736424.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by cgiera <ch...@mic-cust.com>.
Claus Ibsen-2 wrote
> They are not the same. The former is for allowing 2+ routes with the
> same endpoint, eg multiple consumers, eg:
> 
> from A
>   to B
> 
> from A
>   to C
> 
> 
> concurrentConsumers is for the same consumer, eg
> 
> from A concurrentConsumers = 10
>   to B
> 
>> I have looked through the existing components and there are only jms,
>> seda
>> and timer which support this feature. Non of them does fit my
>> requirements
>> exactly(or I don't understand it enough).
>>
>> Sorry if I've missed something and it is really easy, thanks for your
>> time.
>>
>> kind regards,
>> Christoph
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: 

> cibsen@

> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

Hello,

yes I want to implement

from A concurrentConsumers = 10
  to B

but there I'm missing the step where I can easily create/register more than
1 consumer.

kind regards,
Christoph



--
View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266p5736424.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Adding MultiConsumer support to a ScheduledPollEndpoint/ScheduledPollConsumer

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 25, 2013 at 1:22 PM, cgiera <ch...@mic-cust.com> wrote:
> Hello,
>
> I have to write a new Camel component which should have the similar behavior
> like the JmsComponent but I'm not allowed to use Jms(due customer
> restrictions).
>
> I want to use as much functionallity as possible from the standard
> implementations in camel.
> So I decided to extend from the DefaultScheduledPollEndpoint/Consumer to get
> all the inital delay, delay... stuff.
> In the poll method I just use the JdbcTemplate to call a pl/sql procedure
> which dequeues the data.
>
> What is missing now is the MultiConsumer support so I can provide the
> concurrentConsumer parameters  we use in our JMS routes nowadays.
>

They are not the same. The former is for allowing 2+ routes with the
same endpoint, eg multiple consumers, eg:

from A
  to B

from A
  to C


concurrentConsumers is for the same consumer, eg

from A concurrentConsumers = 10
  to B

> I have looked through the existing components and there are only jms, seda
> and timer which support this feature. Non of them does fit my requirements
> exactly(or I don't understand it enough).
>
> Sorry if I've missed something and it is really easy, thanks for your time.
>
> kind regards,
> Christoph
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Adding-MultiConsumer-support-to-a-ScheduledPollEndpoint-ScheduledPollConsumer-tp5736266.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen