camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] Commented: (CAMEL-2991) Restart CamelContext won't restart services on CxfBeanEndpoint
Date Mon, 26 Jul 2010 07:45:52 GMT


Claus Ibsen commented on CAMEL-2991:

I found a problem in {{CamelDestination}} as it just creates a new {{DefaultCamelContext}}

    public CamelContext getCamelContext() {
        if (camelContext == null) {
            getLogger().log(Level.INFO, "No CamelContext injected, create a default one");
            camelContext = new DefaultCamelContext();
        return camelContext;

This is a big no no. And I have fixed the issue as the CamelContext can be obtained from the
{{CxfBeanComponent}} which has the context injected.

Also there was an issue when creating a CxfConsumer and if that failed with an Exception it
was just logged. Instead a FailedToCreateConsumerException should be thrown. We should fail
fast in such cases.

Fixed the above issue and polished the code and javadoc

trunk: 979188.

> Restart CamelContext won't restart services on CxfBeanEndpoint
> --------------------------------------------------------------
>                 Key: CAMEL-2991
>                 URL:
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-cxf
>            Reporter: William Tam
>            Assignee: William Tam
>             Fix For: 2.5.0
>         Attachments: CAMEL-2991.patch
> A route that sends to a CxfBean destination is unusable after the CamelContext has been
stopped and re-started.  The following is an example of a route that demonstrates the problem.
> {code}
> 	<camelContext id="camel" xmlns="">
> 		<route>
> 			<from uri="jetty:http://localhost:9000?matchOnUriPrefix=true" />
> 			<to uri="cxfbean:customerServiceBean" />
> 		</route>
> 	</camelContext>
> 	<util:list id="customerServiceBean">
> 		<bean class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" />
> 	</util:list>
> {code}
> The follow issues have been identified.
> 1) SendProcessor should implement the Navigate interface so that its children (if they
are Services) can be managed by the lifecycle methods.  This will address any destination
endpoint that requires services to be re-started.
> 2) CxfBeanEndpoint should be a Service itself.  The reason why the start() on CxfBeanEndpoint
gets called during the first start is because CxfBeanComponent.start() gets invoked during
route definition initialization.   The problem is that re-starting doesn't trigger the CxfBeanComponent.start()
method.  Therefore, putting the hook in CxfBeanComponent to start/stop CxfBeanEndpoint was
a bug.
> 3) The default type converter which is a Service won't get "re-started' as the (lazy-instantiation)
getTypeConverter() method won't perform addService() on a created but "stopped' typeConverter.
 We need to discuss the correct remedy since I am not sure how to fix it.  It is kind of strange
that the type converter is a service (which has the start/stop semantics) and yet it can be
used even the CamelContext is stopped (or never started).  In the patch, I just set the type
converter to null in DefaultCamelContext doStop() for now.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message