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.
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>
The default health check implementation has been moved out of
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
The template components which allows access to the current
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.
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;
If you are using custom type converters and they have not source code generated a loader class (by
@Converter(generateLoader = true)) then Camel needs to be instructed to scan for custom converters. This can be done as shown:
And in XML:
<camelContext loadTypeConverters="true"> </camelContext>
If you are using Camel on Spring Boot, Quarkus or via Camel Main this can also be configured in 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.
DefaultHttpRegistry classes from camel-servlet are moved from camel-servlet into camel-http-common.
HttpRegistryProvider is added and used in
DefaultHttpRegistry instead of
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.
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) );
The thread pools managed and created by Camels 'ExecutorServiceManager' or
ThreadPoolFactory is now set to default created thread pools with
allowCoreThreadTimeOut=true. This means that the thread pool can shrink and terminate also the core threads if the pool is idle.
In older versions this was
allowCoreThreadTimeOut=false and the default core size was 10, which means thread pools would typically have 10 threads as minimum. With this change those thread pools can shrink to lower value when core threads become idle as well.
The Spring Boot LRA starter component have changed its auto configuration keys to be similar to using camel-lra with camel-main or camel-quarkus. Change the keys from
camel-archetype-java8 has been removed, as you can just use
A new maven plugin called
camel-component-maven-plugin has been added which intents to help third party component developers to generate all required metadata and configurations Java files. For more info on how to use it in your project, please take a look at plugin’s documentation here.
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