Chapter 2. Migrating to Camel Spring Boot


This guide provides information on migrating from Red Hat Fuse 7 to Camel 3 on Spring Boot.

2.1. Java versions

Camel 3 supports Java 17 and Java 11 but not Java 8.

In Java 11 the JAXB modules have been removed from the JDK, therefore you will need to add them as Maven dependencies (if you use JAXB such as when using XML DSL or the camel-jaxb component):

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.1</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.3.0.1</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.2</version>
</dependency>

NOTE : The Java Platform, Standard Edition 11 Development Kit (JDK 11) is deprecated in Camel Spring Boot 3.x release version and not supported from the further 4.x release versions.

2.2. Modularization of camel-core

In Camel 3.x, camel-core has been split into many JARs as follows:

  • camel-api
  • camel-base
  • camel-caffeine-lrucache
  • camel-cloud
  • camel-core
  • camel-jaxp
  • camel-main
  • camel-management-api
  • camel-management
  • camel-support
  • camel-util
  • camel-util-json

Maven users of Apache Camel can keep using the dependency camel-core which has transitive dependencies on all of its modules, except for camel-main, and therefore no migration is needed.

2.3. Modularization of Components

In Camel 3.x, some of the camel-core components are moved into individual components.

  • camel-attachments
  • camel-bean
  • camel-browse
  • camel-controlbus
  • camel-dataformat
  • camel-dataset
  • camel-direct
  • camel-directvm
  • camel-file
  • camel-language
  • camel-log
  • camel-mock
  • camel-ref
  • camel-rest
  • camel-saga
  • camel-scheduler
  • camel-seda
  • camel-stub
  • camel-timer
  • camel-validator
  • camel-vm
  • camel-xpath
  • camel-xslt
  • camel-xslt-saxon
  • camel-zip-deflater

2.4. Changes to Spring Boot starters

The Maven groupId for the Spring Boot starters is changed from org.apache.camel to org.apache.camel.springboot.

Example

Use:

<dependency>
  <groupId>org.apache.camel.springboot</groupId>
  <artifactId>camel-component-starter</artifactId>
</dependency>

Instead of

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-component-starter</artifactId>
</dependency>

2.5. Multiple CamelContexts per application not supported

Support for multiple CamelContexts has been removed and only one CamelContext per deployment is recommended and supported. The context attribute on the various Camel annotations such as @EndpointInject, @Produce, @Consume etc. has therefore been removed.

2.6. Deprecated APIs and Components

All deprecated APIs and components from Camel 2.x have been removed in Camel 3.

2.6.1. Removed components

All deprecated components from Camel 2.x are removed in Camel 3.x, including the old camel-http, camel-hdfs, camel-mina, camel-mongodb, camel-netty, camel-netty-http, camel-quartz, camel-restlet and camel-rx components.

  • Removed camel-jibx component.
  • Removed camel-boon dataformat.
  • Removed the camel-linkedin component as the Linkedin API 1.0 is no longer supported. Support for the new 2.0 API is tracked by CAMEL-13813.
  • The camel-zookeeper has its route policy functionality removed, instead use ZooKeeperClusterService or the camel-zookeeper-master component.
  • The camel-jetty component no longer supports producer (which has been removed), use camel-http component instead.
  • The twitter-streaming component has been removed as it relied on the deprecated Twitter Streaming API and is no longer functional.

2.6.2. Renamed components

Following components are renamed in Camel 3.x.

  • The Camel-microprofile-metrics has been renamed to camel-micrometer
  • The test component has been renamed to dataset-test and moved out of camel-core into camel-dataset JAR.
  • The http4 component has been renamed to http, and it’s corresponding component package from org.apache.camel.component.http4 to org.apache.camel.component.http. The supported schemes are now only http and https.
  • The hdfs2 component has been renamed to hdfs, and it’s corresponding component package from org.apache.camel.component.hdfs2 to org.apache.camel.component.hdfs. The supported scheme is now hdfs.
  • The mina2 component has been renamed to mina, and it’s corresponding component package from org.apache.camel.component.mina2 to org.apache.camel.component.mina. The supported scheme is now mina.
  • The mongodb3 component has been renamed to mongodb, and it’s corresponding component package from org.apache.camel.component.mongodb3 to org.apache.camel.component.mongodb. The supported scheme is now mongodb.
  • The netty4-http component has been renamed to netty-http, and it’s corresponding component package from org.apache.camel.component.netty4.http to org.apache.camel.component.netty.http. The supported scheme is now netty-http.
  • The netty4 component has been renamed to netty, and it’s corresponding component package from org.apache.camel.component.netty4 to org.apache.camel.component.netty. The supported scheme is now netty.
  • The quartz2 component has been renamed to quartz, and it’s corresponding component package from org.apache.camel.component.quartz2 to org.apache.camel.component.quartz. The supported scheme is now quartz.
  • The rxjava2 component has been renamed to rxjava, and it’s corresponding component package from org.apache.camel.component.rxjava2 to org.apache.camel.component.rxjava.
  • Renamed camel-jetty9 to camel-jetty. The supported scheme is now jetty.

2.7. Changes to Camel components

2.7.1. Mock component

The mock component has been moved out of camel-core. Because of this a number of methods on its assertion clause builder are removed.

2.7.2. ActiveMQ

If you are using the activemq-camel component, then you should migrate to use camel-activemq component, where the component name has changed from org.apache.activemq.camel.component.ActiveMQComponent to org.apache.camel.component.activemq.ActiveMQComponent.

2.7.3. AWS

The component camel-aws has been split into multiple components:

  • camel-aws-cw
  • camel-aws-ddb (which contains both ddb and ddbstreams components)
  • camel-aws-ec2
  • camel-aws-iam
  • camel-aws-kinesis (which contains both kinesis and kinesis-firehose components)
  • camel-aws-kms
  • camel-aws-lambda
  • camel-aws-mq
  • camel-aws-s3
  • camel-aws-sdb
  • camel-aws-ses
  • camel-aws-sns
  • camel-aws-sqs
  • camel-aws-swf
Note

It is recommended to add specifc dependencies for these components.

2.7.4. Camel CXF

The camel-cxf JAR has been divided into SOAP vs REST and Spring and non Spring JARs. It is recommended to choose the specific JAR from the following list when migrating from came-cxf.

  • camel-cxf-soap
  • camel-cxf-spring-soap
  • camel-cxf-rest
  • camel-cxf-spring-rest
  • camel-cxf-transport
  • camel-cxf-spring-transport

For example, if you were using CXF for SOAP and with Spring XML, then select camel-cxf-spring-soap and camel-cxf-spring-transport when migrating from camel-cxf.

When using Spring Boot, choose from the following starter when you migrate from camel-cxf-starter to SOAP or REST:

  • camel-cxf-soap-starter
  • camel-cxf-rest-starter

The camel-cxf XML XSD schemas has also changed namespaces.

Table 2.1. Changes to namespaces
Old NamespaceNew Namespace

http://camel.apache.org/schema/cxf

http://camel.apache.org/schema/cxf/jaxws

http://camel.apache.org/schema/cxf/camel-cxf.xsd

http://camel.apache.org/schema/cxf/jaxws/camel-cxf.xsd

http://camel.apache.org/schema/cxf

http://camel.apache.org/schema/cxf/jaxrs

http://camel.apache.org/schema/cxf/camel-cxf.xsd

http://camel.apache.org/schema/cxf/jaxrs/camel-cxf.xsd

The camel-cxf SOAP component is moved to a new jaxws sub-package, that is, org.apache.camel.component.cxf is now org.apache.camel.component.cxf.jaws. For example, the CxfComponent class is now located in org.apache.camel.component.cxf.jaxws.

2.7.5. FHIR

The camel-fhir component has upgraded it’s hapi-fhir dependency to 4.1.0. The default FHIR version has been changed to R4. Therefore if DSTU3 is desired it has to be explicitly set.

2.7.6. Kafka

The camel-kafka component has removed the options bridgeEndpoint and circularTopicDetection as this is no longer needed as the component is acting as bridging would work on Camel 2.x. In other words camel-kafka will send messages to the topic from the endpoint uri. To override this use the KafkaConstants.OVERRIDE_TOPIC header with the new topic. See more details in the camel-kafka component documentation.

2.7.7. Telegram

The camel-telegram component has moved the authorization token from uri-path to a query parameter instead, e.g. migrate

telegram:bots/myTokenHere

to

telegram:bots?authorizationToken=myTokenHere

2.7.8. JMX

If you run Camel standalone with just camel-core as a dependency, and you want JMX enabled out of the box, then you need to add camel-management as a dependency.

For using ManagedCamelContext you now need to get this extension from CamelContext as follows:

ManagedCamelContext managed = camelContext.getExtension(ManagedCamelContext.class);

2.7.9. XSLT

The XSLT component has moved out of camel-core into camel-xslt and camel-xslt-saxon. The component is separated so camel-xslt is for using the JDK XSTL engine (Xalan), and camel-xslt-saxon is when you use Saxon. This means that you should use xslt and xslt-saxon as component name in your Camel endpoint URIs. If you are using XSLT aggregation strategy, then use org.apache.camel.component.xslt.saxon.XsltSaxonAggregationStrategy for Saxon support. And use org.apache.camel.component.xslt.saxon.XsltSaxonBuilder for Saxon support if using xslt builder. Also notice that allowStax is also only supported in camel-xslt-saxon as this is not supported by the JDK XSLT.

2.7.10. XML DSL Migration

The XML DSL has been changed slightly.

The custom load balancer EIP has changed from <custom> to <customLoadBalancer>

The XMLSecurity data format has renamed the attribute keyOrTrustStoreParametersId to keyOrTrustStoreParametersRef in the <secureXML> tag.

The <zipFile> data format has been renamed to <zipfile>.

2.8. Migrating Camel Maven Plugins

The camel-maven-plugin has been split up into two maven plugins:

camel-maven-plugin
camel-maven-plugin has the run goal, which is intended for quickly running Camel applications standalone. See https://camel.apache.org/manual/camel-maven-plugin.html for more information.
camel-report-maven-plugin
The camel-report-maven-plugin has the validate and route-coverage goals which is used for generating reports of your Camel projects such as validating Camel endpoint URIs and route coverage reports, etc. See https://camel.apache.org/manual/camel-report-maven-plugin.html for more information.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.