You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Gert Vanthienen <ge...@gmail.com> on 2009/12/01 11:21:42 UTC

Re: shutdown->start causing error with camel DeadLetterChannel

Willem,

The Endpoint interface has been extended to allow for a cleaner
shutdown process for consumer endpoints, where the endpoint can
continue handling existing requests without accepting new ones (cfr.
http://svn.apache.org/repos/asf/servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/Endpoint.java).

Perhaps we can reuse the same mechanism for fine-tuning the stop/start
behavior of the Camel endpoints?

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/11/30 Willem Jiang <wi...@gmail.com>:
> Hi,
>
> I had a chance to dig the code of service-camel component trunk.
> Here is what I found :
> For ServiceUnit there are two stages of starting
> prepare for starting --> init()
> start the endpoints of the unit --> start()
>
> And two stages of stopping
> stop the endpoints of the unit --> stop()
> finally stop the service unit --> shutdown()
>
> For service-camel component, it uses XBeanServiceUnit to manage the SU's
> states, the camel context will be stopped if the su's shutdown is called.
> But the camel context will not be restarted even the su's init() is called.
>
> As the SU start method will start the endpoint, we can create a simple
> endpoint which delegate the start and stop method to camel context.
>
> Any thought?
>
>
> Willem
>
> Jean-Baptiste Onofré wrote:
>>
>> Hi Maciek,
>>
>> I'm agree, we haven't a clean behavior between SMX component and camel
>> endpoints. I think the best way is to override the start() method in the
>> camel component to rebind the camel context.
>>
>> Feel free to open a Jira task on this topic.
>>
>> Regards
>> JB
>>
>> Maciej Prochniak wrote:
>>>
>>> Hello,
>>> We found strange (I would say - buggy) behaviour of servicemix-camel
>>> component (SMX 3.3 + servicemix-camel 2008.01).
>>>
>>> Basically we have camel SU using standard dead letter channel. When SA
>>> is shutdown (e.g. because of missing components for other SUs, or using
>>> JMX) and then started, camel route throws RejectedExecutionException.
>>> Looking into the code it is caused by the following:
>>>
>>> 1) Camel context is created during deployment of SU
>>> 2) When shutdown is being called, the applicationContext for given SU i
>>> s destroyed. This includes calling .stop() on camelContext.
>>> 3) When start is called the camel context is still in stopped state (but
>>> its servicemix endpoint are still registered in SMX registry).
>>> 4) Dead letter channel throws exceptions when receiving messages while
>>> being in stopped state.
>>>
>>> For me, this looks like some compatibility issues between camel
>>> endpoints lifecycle and servicemix endpoints lifecycle (this is mostly
>>> coded in AbstractXBeanDeployer and XBeanServiceUnit). The application
>>> context is destroyed in shutdown method, but if start is called
>>> afterwards, endpoint beans are being used - this is rather unpleasant
>>> behaviour in my opinion - maybe camel context should be created during
>>> start of SU?
>>>
>>> Could anybody comment on this?
>>>
>>> thanks and br.
>>> maciek prochniak
>>
>
>

Re: shutdown->start causing error with camel DeadLetterChannel

Posted by Willem Jiang <wi...@gmail.com>.
Hi Gert,

I just create a JIRA[1] with the patch (also a test case). Please review 
it if your have time.

[1] https://issues.apache.org/activemq/browse/SMXCOMP-687

Thanks,

Willem
Gert Vanthienen wrote:
> Willem,
> 
> The Endpoint interface has been extended to allow for a cleaner
> shutdown process for consumer endpoints, where the endpoint can
> continue handling existing requests without accepting new ones (cfr.
> http://svn.apache.org/repos/asf/servicemix/components/shared-libraries/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/Endpoint.java).
> 
> Perhaps we can reuse the same mechanism for fine-tuning the stop/start
> behavior of the Camel endpoints?
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/30 Willem Jiang <wi...@gmail.com>:
>> Hi,
>>
>> I had a chance to dig the code of service-camel component trunk.
>> Here is what I found :
>> For ServiceUnit there are two stages of starting
>> prepare for starting --> init()
>> start the endpoints of the unit --> start()
>>
>> And two stages of stopping
>> stop the endpoints of the unit --> stop()
>> finally stop the service unit --> shutdown()
>>
>> For service-camel component, it uses XBeanServiceUnit to manage the SU's
>> states, the camel context will be stopped if the su's shutdown is called.
>> But the camel context will not be restarted even the su's init() is called.
>>
>> As the SU start method will start the endpoint, we can create a simple
>> endpoint which delegate the start and stop method to camel context.
>>
>> Any thought?
>>
>>
>> Willem
>>
>> Jean-Baptiste Onofré wrote:
>>> Hi Maciek,
>>>
>>> I'm agree, we haven't a clean behavior between SMX component and camel
>>> endpoints. I think the best way is to override the start() method in the
>>> camel component to rebind the camel context.
>>>
>>> Feel free to open a Jira task on this topic.
>>>
>>> Regards
>>> JB
>>>
>>> Maciej Prochniak wrote:
>>>> Hello,
>>>> We found strange (I would say - buggy) behaviour of servicemix-camel
>>>> component (SMX 3.3 + servicemix-camel 2008.01).
>>>>
>>>> Basically we have camel SU using standard dead letter channel. When SA
>>>> is shutdown (e.g. because of missing components for other SUs, or using
>>>> JMX) and then started, camel route throws RejectedExecutionException.
>>>> Looking into the code it is caused by the following:
>>>>
>>>> 1) Camel context is created during deployment of SU
>>>> 2) When shutdown is being called, the applicationContext for given SU i
>>>> s destroyed. This includes calling .stop() on camelContext.
>>>> 3) When start is called the camel context is still in stopped state (but
>>>> its servicemix endpoint are still registered in SMX registry).
>>>> 4) Dead letter channel throws exceptions when receiving messages while
>>>> being in stopped state.
>>>>
>>>> For me, this looks like some compatibility issues between camel
>>>> endpoints lifecycle and servicemix endpoints lifecycle (this is mostly
>>>> coded in AbstractXBeanDeployer and XBeanServiceUnit). The application
>>>> context is destroyed in shutdown method, but if start is called
>>>> afterwards, endpoint beans are being used - this is rather unpleasant
>>>> behaviour in my opinion - maybe camel context should be created during
>>>> start of SU?
>>>>
>>>> Could anybody comment on this?
>>>>
>>>> thanks and br.
>>>> maciek prochniak
>>
>