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.3 to 3.4

camel-test and JMX

The camel-test module no longer has dependency on camel-management out of the box. In Camel JMX is optional and to use JMX then camel-management must be added as dependency.

For example to use JMX during testing you the following dependency as test scope:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-management</artifactId>
    <scope>test</scope>
</dependency>

Health Check

The default health check implementation has been moved out of camel-base into camel-health as a separate module. The health check has been refactored and there are some APIs and classes that has been changed. The health check in camel-consul has been removed.

The old health check was not fully implemented and was only targeting Spring Boot. The new system is more generic and supports all Camel runtimes.

An example is provided in camel-example-main-health.

Template components

The template components which allows access to the current Exchange and CamelContext API from the context map available for templating has now been restricted to only the message body and headers.

This option can be enabled (allowContextMapAll=true) for full access to the current Exchange and CamelContext. Doing so impose a potential security risk as this opens access to the full power of CamelContext API.

This applies to the following templating components: camel-freemarker, camel-velocity, camel-mvel, camel-mustache, camel-string-template, camel-chunk, camel-robotframework.

Using custom language in RouteBuilder

The Java DSL RouteBuilder allows referring to a custom language as shown below:

from("direct:start")
    .filter(language("foo", "Bla bla bla"))
      .to("mock:camel");

This functionality is seldom in use, as you would use the provided languages from Camel. If using, then the language method now requires a static import as shown below:

import static org.apache.camel.builder.Builder.language;

camel-spring-boot

The /actuator/camelroutes HTTP endpoint has been removed from provided Spring Boot actuators in camel-spring-boot. This actuator was becoming problematic to maintain during Spring Boot upgrades due to changes in Spring Boot.

camel-servlet and camel-http-common

HttpRegistry and DefaultHttpRegistry classes from camel-servlet are moved from camel-servlet into camel-http-common. HttpRegistryProvider is added and used in DefaultHttpRegistry instead of CamelServlet.

These changes had effects on camel-atmosphere-websocket and camel-servlet and also camel-resteasy. Users of these components where they would have custom implemetations on DefaultHttpRegistry and using CamelServlet class should take this change into account.

camel-sql

The JdbcAggregationRepository optimistic locking feature has been fixed to work on a distributed environment and every database. There is a new version column that is required and must be added to the repository:

CREATE TABLE aggregation (
 id varchar(255) NOT NULL,
 exchange blob NOT NULL,
 version BIGINT NOT NULL,
 constraint aggregation_pk PRIMARY KEY (id)
);
CREATE TABLE aggregation_completed (
 id varchar(255) NOT NULL,
 exchange blob NOT NULL,
 version BIGINT NOT NULL,
 constraint aggregation_completed_pk PRIMARY KEY (id)
);

Maven Archetypes

The camel-archetype-java8 has been removed, as you can just use camel-archetype-java instead.

Camel-Kafka

From a lot of time, the headerFilterStrategy application in consumer and producer was done in an interchanged way. You need to have a look at the following issue for more information: https://issues.apache.org/jira/browse/CAMEL-15121