Apache Camel 3.x Upgrade Guide

This document is for helping you upgrade your Apache Camel application from Camel 3.x to 3.y. For example if you are upgrading Camel 3.0 to 3.2, then you should follow the guides from both 3.0 to 3.1 and 3.1 to 3.2.

Upgrading Camel 3.5 to 3.6

API components upgrade

The camel-braintree, camel-twilio and camel-zendesk has updated to newer versions and regenerated their API signatures in the Camel components which changed a few existing API methods and adding new API methods as well.

API components overhauled

The following API component has been overhauled, by having a new Java source parser to inspect API and fully generate Camel endpoint configuration and documentation gathered from javadoc.

The components affected are:

  • camel-as2

  • camel-box

  • camel-braintree

  • camel-fhir

  • camel-google-calendar

  • camel-google-drive

  • camel-google-email

  • camel-google-sheets

  • camel-olingo2

  • camel-olingo4

  • camel-twilio

  • camel-zendesk

Customizers

Customizers, which are objects used to configure some of the Camel services such as component, language and data formats, that were previously limited to Camel Spring Boot, are now consistently used across runtimes. To make that possible, the interfaces have been changed and they do not use generics anymore.

Impacted interfaces:

  • org.apache.camel.spi.ComponentCustomizer

  • org.apache.camel.spi.LanguageCustomizer

  • org.apache.camel.spi.DataFormatCustomizer

As example the signature of the ComponentCustomizer interface in Camel 3.5 is:

@FunctionalInterface
public interface ComponentCustomizer<T extends Component> {
    /**
     * Customize the specified {@link Component}.
     *
     * @param component the component to customize
     */
    void customize(T component);
}

And below the Camel 3.6 version:

@FunctionalInterface
public interface ComponentCustomizer {
    /**
     * Customize the specified {@link Component}.
     *
     * @param name   the unique name of the component
     * @param target the component to configure
     */
    void configure(String name, Component target);

    /**
     * Checks whether this customizer should be applied to the given {@link Component}.
     *
     * @param  name   the unique name of the component
     * @param  target the component to configure
     * @return        <tt>true</tt> if the customizer should be applied
     */
    default boolean isEnabled(String name, Component target) {
        return true;
    }

    @Override
    default int getOrder() {
        return 0;
    }
}

As the customizer are now taken into account as part of the standard lifecycle of the CamelContext, to programmatically configure a component, it is enough to register the appropriate customizer in the Registry as example:

public class Application {

    public static void main(String args) throws Exception {
        Main main = new Main();
        main.addConfigurationClass(MyConfiguration.class);
        main.run(args);
    }

    public static class MyConfiguration {
        @BindToRegistry
        public ComponentCustomizer logCustomizer() {
            // Use a fluent Component Customizer builder to ease the process of creating an customizer.
            return ComponentCustomizer.builder(LogComponent.class)
                    .build(component -> component.setExchangeFormatter(new DefaultExchangeFormatter()));
        }
    }
}

As a consequence of this change, the Camel Spring Boot starters have been amended to use Customizers instead of creating instances of components, languages or data formats.

Component Verifiers

Camel components which provides ComponentVerifierExtension should have camel-core-catalog added as dependency at runtime, if the verifier are in use. You will see an exception about camel-core-catalog not found on classpath otherwise.

SendDynamicAware

The API in org.apache.camel.spi.SendDynamicAware has changed and any custom implementations must be updated accordingly. There is a new abstract org.apache.camel.support.component.SendDynamicAwareSupport class which can be used as base for custom implementations.

Camel Caffeine

To configure the component to use a pre-configured cache, it is not more required to use the now removed cache option as the component perorm a look-up from the registry based on the cacheName URI param.

As example, the following code:

.to("caffeine-cache://cache?cache=#myCache&action=PUT&key=1")

Should eb replaced by:

.to("caffeine-cache://myCache?action=PUT&key=1")

Camel Karaf

The following features has been removed due they become not compatible with OSGi: camel-atmosphere-websocket.