LibraryToggle FramesPrintFeedback

Summary of Apache Camel 2.9 to Apache Camel 2.10 Migration

Overview

Fuse ESB Enterprise 7.1.0.fuse-047 uses Apache Camel 2.10. Since the last release, Apache Camel has been upgraded from version 2.9 to version 2.10. This introduces a few migration issues.

Notices

The most important change in Apache Camel 2.10 is that Apache Camel now supports Java 7 (JDK 1.7).

You should also note the following important changes:

  • Maven 3.0.2 or better is required to build the source.

Product dependencies

In Apache Camel 2.10, some components have had their third party dependencies upgraded. See Product Dependencies for details.

API changes

In Apache Camel 2.10, the following changes have been made to the Java API:

ShutdownStrategy

Since Apache Camel version 2.10, the shutdownForced and forceShutdown methods have been added to the org.apache.camel.spi.ShutdownStrategy interface.

ShutdownAware

Since Apache Camel version 2.10, the ShutdownAware interface inherits from the ShutdownPrepared interface, which defines the additional prepareShutdown method.

RouteBuilder

Since Apache Camel version 2.10, the errorHandler method from the org.apache.camel.builder.RouteBuilder interface returns void.

SimpleLanguage

Since Apache Camel version 2.10, the SimpleLanguage constructor that takes custom start and end tokens has been removed. Use the static SimpleLanguage.changeFunctionStartToken method and the SimpleLanguage.changeFunctionEndToken method instead.

LifecycleStrategy

Since Apache Camel version 2.10, the onThreadPoolRemove method and the onErrorHandlerRemove method have been added to the org.apache.camel.spi.LifecycleStrategy interface.

OnExceptionDefinition

Since Apache Camel version 2.10, the retryWhile(Expression) method has been removed from the org.apache.camel.model.OnExceptionDefinition interface. Use the retryWhile(Predicate) method instead.

TypeConverter

Since Apache Camel version 2.10, the convertTo methods on org.apache.camel.TypeConverter throw TypeConversionException, if an exception occurs during type conversion. New tryConvertTo methods have been added to TypeConverter, which ignore any exceptions that might occur during conversion.

Message

Since Apache Camel version 2.10, the getBody(type) method and the getHeader(name, type) method from org.apache.camel.Message now throw TypeConversionException, if an exception occurs during type conversion.

UnitOfWork

Since Apache Camel version 2.10, the containsSynchronization method has been added to the org.apache.camel.spi.UnitOfWork interface.

Exchange

Since Apache Camel version 2.10, the containsSynchronization method has been added to the org.apache.camel.Exchange interface.

Since Apache Camel version 2.10, the isTransactionRedelivered method has been added to the org.apache.camel.Exchange interface.

CamelContext

Since Apache Camel version 2.10, the setManagementName method has been removed from org.apache.camel.CamelContext.

GenericFile

Since Apache Camel version 2.10, the isDirectory method has been added to the org.apache.camel.component.file.GenericFile interface.

TypeConverterRegistry

Since Apache Camel version 2.10, the getStatistics method has been added to the org.apache.camel.spi.TypeConverterRegistry interface.

GenericFileProcessStrategy

Since Apache Camel version 2.10, the abort method has been added to the org.apache.camel.component.file.GenericFileProcessStrategy interface.

Component updates

In Apache Camel 2.10, you need to consider the following component updates:

  • Netty component—removed the corePoolSize and maxPoolSize thread pool options.

    The API for the ClientPipelineFactory and ServerPipelineFactory abstract classes has changed.

  • CXFRS component—the resourceClasses option no longer recognizes the semicolon character, ;, as a separator for class names. Use the comma character, ,, instead.

  • Mail component—now excludes the dependency on the javax.activation JAR, because that dependency is embedded in the JVM from Java 6 onwards.

  • Test component—Spring testing features have been moved from the camel-test artifact to the camel-test-spring artifact.

  • File component—you can now use the charset option on the File component to specify the character encoding to use for reading and writing files.

Simple language

The simple language no longer trims white space surrounding an expression in the Java DSL. On the other hand, the simple language does trims white space surrounding an expression in the XML DSL by default, but you can disable this behavior by setting trim="false" in the simple element.

convertBodyTo DSL command

In this release, the convertBodyTo DSL command does not propagate the character set as an exchange property when the charset option is set (in previous releases, the character set was propagated in the Exchange.CHARSET_NAME property).

URI normalization

URI normalization now recognizes pre-existing %nn decimal encodings in URI strings.

Intercept

When using Apache Camel interceptors, the behavior when combining the skipSendToOriginalEndpoint() clause with the when() predicate has changed in Apache Camel 2.10.

Now, when you combine the skipSendToOriginalEndpoint() clause with a when() predicate, the original endpoint is skipped, only if the when() predicate evaluates to true. For example, in the following route, the mock:result endpoint will be skipped, only if the message body is equal to Hello World:

interceptSendToEndpoint("mock:foo")
    .skipSendToOriginalEndpoint()
    .when(body().isEqualTo("Hello World"))
    .to("mock:detour").transform(constant("Bye World"));

from("direct:second")
    .to("mock:bar")
    .to("mock:foo")
    .to("mock:result");

In previous versions, the original endpoint would have been skipped, even if the when() predicate evaluated to false.

Thread name pattern

The default pattern for thread names is now:

Camel (#camelId#) thread ##counter# - #name#

In previous releases the thread name pattern was:

Camel (${camelId}) thread #${counter} - ${name}

Poll enrich

The pollEnrich DSL command now blocks, if no messages are available and no timeout has been configured.

Type converters

The setting lazyLoadTypeConverter=true is now deprecated and will be removed in a future release. The recommended practice is to load type converters at start up time.

The Apache Camel test kit no longer lazily loads type converters.

Apache Camel now fails faster during type conversion, by throwing TypeConversionException to the caller.

Apache Camel no longer supports using java.beans.PropertyEditor for type conversion. This approach is slow, not thread safe, and uses third party JARs on the classpath, which can cause unwanted side effects.

MDC logging

The keys for MDC logging are now prefixed with .camel.

Wire tap

It is no longer possible to change the destination of the wire tap enterprise integration pattern from JMX.

Comments powered by Disqus