camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: SEDA and concurrentConsumers
Date Wed, 12 Sep 2012 07:42:00 GMT
On Wed, Sep 12, 2012 at 9:31 AM, Tim Dudgeon <tdudgeon.ml@gmail.com> wrote:
> OK, thanks. So I think I get it now. Some params need defining on the 'from'
> side and some on the 'to' side. And the order the queue appears in the
> routes is important. So this seems to work for me. Is this correct?
>
>         from('seda:insert?concurrentConsumers=2&size=3')
>                 .delay(1000)
>
>                 .log('seda ${body}')
>
>         from('direct:start')
>                 .split(body())
>                 .log('direct ${body}')
>                 .to('seda:insert?blockWhenFull=true')
>
>
> For instance, if the two routes are defined in the other order its doesn't
> work as wanted.
>

Yes the size option matters, as the first endpoint that creates the
queue will control its size.
So if you want to limit then make sure to have size on the first
endpoint. Better yet on all the endpoints.

But the block option is only for the producer.

Another option is to define the endpoint, and then refer to it in the routes

configure() {

   Endpoint insert =
endpoint('seda:insert?concurrentConsumers=2&size=3&blockWhenFull=true');

   from(insert)
      ...

     ...
     to(insert)


> Tim
>
>
>
> On 12/09/2012 07:54, Claus Ibsen wrote:
>>
>> On Wed, Sep 12, 2012 at 8:52 AM, Tim Dudgeon <tdudgeon.ml@gmail.com>
>> wrote:
>>>
>>> Great. That works. Thanks.
>>> BTW, the example in the Camel in Action book (p 322) seems wrong then as
>>> it
>>> describes it the way I originally had it.
>>>
>> The book is not wrong. The block parameter is on the *producer* side,
>> so you should have it in the "to".
>>
>>
>>> Tim
>>>
>>>
>>>
>>> On 12/09/2012 03:34, Willem jiang wrote:
>>>>
>>>> You need set the seda endpoint parameter on the first one endpoint,
>>>> because Camel will pickup the created queue in the next endpoint.
>>>>
>>>> Please change the first route like this
>>>> …
>>>>>
>>>>> .log('direct ${body}')
>>>>> .to('seda:insert?blockWhenFull=true&size=5')
>>>
>>>
>>
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message