You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Donald Whytock <dw...@gmail.com> on 2010/10/13 21:58:13 UTC
SEDA createConsumer() question
Hi all...
If I have a SEDA endpoint set up for not multiple consumers and I use
createConsumer(processor), will that replace the current consumer? Or
simply add a consumer that will never be reached?
Don
Re: SEDA createConsumer() question
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 15, 2010 at 5:25 PM, Donald Whytock <dw...@gmail.com> wrote:
> Would that be CamelContext.shutdownRoute(id)? And does that use
> RouteDefinition.id() or RouteDefinition.routeId()?
>
The route id, since you are shutting down a route with that given id.
Which you set as follows
<route id="xxx">
<from uri="seda:..."/>
...
from("sedq").routeId("xxx")...
> On Thu, Oct 14, 2010 at 9:24 PM, Willem Jiang <wi...@gmail.com> wrote:
>> In Camel 2.5.0,you can do it by stopping old route which start with the SEDA
>> endpoint and adding a new route for it.
>>
>> Here is an unit test[1] that you can take a look.
>>
>> [1]
>> https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaMultipleConsumersTest.java
>>
>>
>> On 10/14/10 10:44 PM, Donald Whytock wrote:
>>>
>>> I'm not looking to add an additional consumer; I'm looking to replace
>>> the existing one.
>>>
>>> In my Chatterbot app, I'm looking to set up a pipeline of message
>>> handlers in an osgi environment. I'll have a service that collects
>>> message handlers and builds a pipeline from them. But since message
>>> handlers can come and go, the service will need to be able to rebuild
>>> the pipeline when a new message handler starts or an existing message
>>> handler stops.
>>>
>>> What I'd hoped was that if the SEDA queue's endpoint was set up for
>>> not multiple consumers, creating a new consumer for the endpoint would
>>> replace the existing consumer. I take it that that won't
>>> happen...that instead the new consumer would be ignored? Is there a
>>> way to explicitly override the consumers for an endpoint?
>>>
>>> Alternately, is it possible to change the pipeline to use a new
>>> List<Consumer>?
>>>
>>> Or am I stuck with tracking the route being added, removing it from
>>> the context and creating a new one?
>>>
>>> Don
>>>
>>> On Thu, Oct 14, 2010 at 4:00 AM, Willem Jiang<wi...@gmail.com>
>>> wrote:
>>>>
>>>> On 10/14/10 3:58 AM, Donald Whytock wrote:
>>>>>
>>>>> Hi all...
>>>>>
>>>>> If I have a SEDA endpoint set up for not multiple consumers and I use
>>>>> createConsumer(processor), will that replace the current consumer? Or
>>>>> simply add a consumer that will never be reached?
>>>>>
>>>>> Don
>>>>>
>>>>
>>>> The option of support the multiple consumers if just used to make sure
>>>> the
>>>> routes which are added to the camel context should not have the same from
>>>> endpoint.
>>>>
>>>> In Camel 2.5 we fixed an issue[1] of tracking the multiple seda
>>>> consumers.
>>>>
>>>> If you are using Camel 2.4.0, your new added consumer will not be used,
>>>>
>>>> [1]https://issues.apache.org/activemq/browse/CAMEL-3119
>>>>
>>>> --
>>>> Willem
>>>> ----------------------------------
>>>> Open Source Integration: http://www.fusesource.com
>>>> Blog: http://willemjiang.blogspot.com (English)
>>>> http://jnn.javaeye.com (Chinese)
>>>> Twitter: http://twitter.com/willemjiang
>>>>
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>>
>
--
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: SEDA createConsumer() question
Posted by Donald Whytock <dw...@gmail.com>.
Would that be CamelContext.shutdownRoute(id)? And does that use
RouteDefinition.id() or RouteDefinition.routeId()?
On Thu, Oct 14, 2010 at 9:24 PM, Willem Jiang <wi...@gmail.com> wrote:
> In Camel 2.5.0,you can do it by stopping old route which start with the SEDA
> endpoint and adding a new route for it.
>
> Here is an unit test[1] that you can take a look.
>
> [1]
> https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaMultipleConsumersTest.java
>
>
> On 10/14/10 10:44 PM, Donald Whytock wrote:
>>
>> I'm not looking to add an additional consumer; I'm looking to replace
>> the existing one.
>>
>> In my Chatterbot app, I'm looking to set up a pipeline of message
>> handlers in an osgi environment. I'll have a service that collects
>> message handlers and builds a pipeline from them. But since message
>> handlers can come and go, the service will need to be able to rebuild
>> the pipeline when a new message handler starts or an existing message
>> handler stops.
>>
>> What I'd hoped was that if the SEDA queue's endpoint was set up for
>> not multiple consumers, creating a new consumer for the endpoint would
>> replace the existing consumer. I take it that that won't
>> happen...that instead the new consumer would be ignored? Is there a
>> way to explicitly override the consumers for an endpoint?
>>
>> Alternately, is it possible to change the pipeline to use a new
>> List<Consumer>?
>>
>> Or am I stuck with tracking the route being added, removing it from
>> the context and creating a new one?
>>
>> Don
>>
>> On Thu, Oct 14, 2010 at 4:00 AM, Willem Jiang<wi...@gmail.com>
>> wrote:
>>>
>>> On 10/14/10 3:58 AM, Donald Whytock wrote:
>>>>
>>>> Hi all...
>>>>
>>>> If I have a SEDA endpoint set up for not multiple consumers and I use
>>>> createConsumer(processor), will that replace the current consumer? Or
>>>> simply add a consumer that will never be reached?
>>>>
>>>> Don
>>>>
>>>
>>> The option of support the multiple consumers if just used to make sure
>>> the
>>> routes which are added to the camel context should not have the same from
>>> endpoint.
>>>
>>> In Camel 2.5 we fixed an issue[1] of tracking the multiple seda
>>> consumers.
>>>
>>> If you are using Camel 2.4.0, your new added consumer will not be used,
>>>
>>> [1]https://issues.apache.org/activemq/browse/CAMEL-3119
>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> Open Source Integration: http://www.fusesource.com
>>> Blog: http://willemjiang.blogspot.com (English)
>>> http://jnn.javaeye.com (Chinese)
>>> Twitter: http://twitter.com/willemjiang
>>>
>>
>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>
Re: SEDA createConsumer() question
Posted by Willem Jiang <wi...@gmail.com>.
In Camel 2.5.0,you can do it by stopping old route which start with the
SEDA endpoint and adding a new route for it.
Here is an unit test[1] that you can take a look.
[1]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaMultipleConsumersTest.java
On 10/14/10 10:44 PM, Donald Whytock wrote:
> I'm not looking to add an additional consumer; I'm looking to replace
> the existing one.
>
> In my Chatterbot app, I'm looking to set up a pipeline of message
> handlers in an osgi environment. I'll have a service that collects
> message handlers and builds a pipeline from them. But since message
> handlers can come and go, the service will need to be able to rebuild
> the pipeline when a new message handler starts or an existing message
> handler stops.
>
> What I'd hoped was that if the SEDA queue's endpoint was set up for
> not multiple consumers, creating a new consumer for the endpoint would
> replace the existing consumer. I take it that that won't
> happen...that instead the new consumer would be ignored? Is there a
> way to explicitly override the consumers for an endpoint?
>
> Alternately, is it possible to change the pipeline to use a new List<Consumer>?
>
> Or am I stuck with tracking the route being added, removing it from
> the context and creating a new one?
>
> Don
>
> On Thu, Oct 14, 2010 at 4:00 AM, Willem Jiang<wi...@gmail.com> wrote:
>> On 10/14/10 3:58 AM, Donald Whytock wrote:
>>>
>>> Hi all...
>>>
>>> If I have a SEDA endpoint set up for not multiple consumers and I use
>>> createConsumer(processor), will that replace the current consumer? Or
>>> simply add a consumer that will never be reached?
>>>
>>> Don
>>>
>>
>> The option of support the multiple consumers if just used to make sure the
>> routes which are added to the camel context should not have the same from
>> endpoint.
>>
>> In Camel 2.5 we fixed an issue[1] of tracking the multiple seda consumers.
>>
>> If you are using Camel 2.4.0, your new added consumer will not be used,
>>
>> [1]https://issues.apache.org/activemq/browse/CAMEL-3119
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>>
>
--
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang
Re: SEDA createConsumer() question
Posted by Donald Whytock <dw...@gmail.com>.
Okay, potentially answering my own question, perhaps DelegateProcessor
would serve for me...
List<Processor> processors = new ArrayList<Processor>;
/* add some processors */
DelegateProcessor delegate = new DelegateProcessor(new Pipeline(processors));
Inside a RouteBuilder...
from("seda:queue").process(delegate);
...and when the processor list changes...
delegate.setProcessor(new Pipeline(processors));
So the route stays intact, and the endpoint stays intact, and a given
pipeline stays intact, but I can change it dynamically, right?
Don
On Thu, Oct 14, 2010 at 10:44 AM, Donald Whytock <dw...@gmail.com> wrote:
> I'm not looking to add an additional consumer; I'm looking to replace
> the existing one.
>
> In my Chatterbot app, I'm looking to set up a pipeline of message
> handlers in an osgi environment. I'll have a service that collects
> message handlers and builds a pipeline from them. But since message
> handlers can come and go, the service will need to be able to rebuild
> the pipeline when a new message handler starts or an existing message
> handler stops.
>
> What I'd hoped was that if the SEDA queue's endpoint was set up for
> not multiple consumers, creating a new consumer for the endpoint would
> replace the existing consumer. I take it that that won't
> happen...that instead the new consumer would be ignored? Is there a
> way to explicitly override the consumers for an endpoint?
>
> Alternately, is it possible to change the pipeline to use a new List<Consumer>?
>
> Or am I stuck with tracking the route being added, removing it from
> the context and creating a new one?
>
> Don
>
> On Thu, Oct 14, 2010 at 4:00 AM, Willem Jiang <wi...@gmail.com> wrote:
>> On 10/14/10 3:58 AM, Donald Whytock wrote:
>>>
>>> Hi all...
>>>
>>> If I have a SEDA endpoint set up for not multiple consumers and I use
>>> createConsumer(processor), will that replace the current consumer? Or
>>> simply add a consumer that will never be reached?
>>>
>>> Don
>>>
>>
>> The option of support the multiple consumers if just used to make sure the
>> routes which are added to the camel context should not have the same from
>> endpoint.
>>
>> In Camel 2.5 we fixed an issue[1] of tracking the multiple seda consumers.
>>
>> If you are using Camel 2.4.0, your new added consumer will not be used,
>>
>> [1]https://issues.apache.org/activemq/browse/CAMEL-3119
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>>
>
Re: SEDA createConsumer() question
Posted by Donald Whytock <dw...@gmail.com>.
I'm not looking to add an additional consumer; I'm looking to replace
the existing one.
In my Chatterbot app, I'm looking to set up a pipeline of message
handlers in an osgi environment. I'll have a service that collects
message handlers and builds a pipeline from them. But since message
handlers can come and go, the service will need to be able to rebuild
the pipeline when a new message handler starts or an existing message
handler stops.
What I'd hoped was that if the SEDA queue's endpoint was set up for
not multiple consumers, creating a new consumer for the endpoint would
replace the existing consumer. I take it that that won't
happen...that instead the new consumer would be ignored? Is there a
way to explicitly override the consumers for an endpoint?
Alternately, is it possible to change the pipeline to use a new List<Consumer>?
Or am I stuck with tracking the route being added, removing it from
the context and creating a new one?
Don
On Thu, Oct 14, 2010 at 4:00 AM, Willem Jiang <wi...@gmail.com> wrote:
> On 10/14/10 3:58 AM, Donald Whytock wrote:
>>
>> Hi all...
>>
>> If I have a SEDA endpoint set up for not multiple consumers and I use
>> createConsumer(processor), will that replace the current consumer? Or
>> simply add a consumer that will never be reached?
>>
>> Don
>>
>
> The option of support the multiple consumers if just used to make sure the
> routes which are added to the camel context should not have the same from
> endpoint.
>
> In Camel 2.5 we fixed an issue[1] of tracking the multiple seda consumers.
>
> If you are using Camel 2.4.0, your new added consumer will not be used,
>
> [1]https://issues.apache.org/activemq/browse/CAMEL-3119
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>
Re: SEDA createConsumer() question
Posted by Willem Jiang <wi...@gmail.com>.
On 10/14/10 3:58 AM, Donald Whytock wrote:
> Hi all...
>
> If I have a SEDA endpoint set up for not multiple consumers and I use
> createConsumer(processor), will that replace the current consumer? Or
> simply add a consumer that will never be reached?
>
> Don
>
The option of support the multiple consumers if just used to make sure
the routes which are added to the camel context should not have the
same from endpoint.
In Camel 2.5 we fixed an issue[1] of tracking the multiple seda consumers.
If you are using Camel 2.4.0, your new added consumer will not be used,
[1]https://issues.apache.org/activemq/browse/CAMEL-3119
--
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang