camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Chiarello (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-9431) TypeConverter autoconfiguration leads to invalid shutdown sequence
Date Thu, 17 Dec 2015 14:13:46 GMT
Laurent Chiarello created CAMEL-9431:
----------------------------------------

             Summary: TypeConverter autoconfiguration leads to invalid shutdown sequence
                 Key: CAMEL-9431
                 URL: https://issues.apache.org/jira/browse/CAMEL-9431
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-boot
    Affects Versions: 2.16.1
            Reporter: Laurent Chiarello
         Attachments: CamelSpringBootShutdownTest.java

When using autoconfiguration provided by the {{camel-spring-boot}} artifact,  a {{TypeConverter}}
bean is automatically registered into the Spring context: 

{code:title=TypeConversionConfiguration.java}
@Bean
TypeConverter typeConverter(CamelContext camelContext) {
    return camelContext.getTypeConverter();
}
{code}

The returned bean is an instance of {{DefaultTypeConverter}}, which in turn implements {{ServiceSupport}}
and its method {{public void shutdown()}}. This method is infered as a _destroy-method_ by
Spring, and called during the shutdown of the ApplicationContext. 

As a consequence, the TypeConverter will be destroyed before the CamelContext, effectively
preventing any type conversion support for the inflight messages that have still to be processed
during the graceful shutdown period of Camel. 

AFAIK the simple fix would be to disable the destroy-method inference using {{@Bean(destroyMethod="")}}.
This will let Camel have a chance to perform a clean shutdown in the right sequence. 

As a workaround, it is possible to entirely disable the registration of the type converter
in Spring using the property
{{camel.springboot.type-conversion = false}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message