Chapter 3. Migrating from Camel 2 to Camel 3
Camel Extensions for Quarkus supports Camel version 3 whereas Fuse 7 supported Camel version 2. This section provides information relating to upgrading Camel when you migrate your Red Hat Fuse 7 application to Camel Extensions for Quarkus.
3.1. Java versions
Camel 3 supports Java 17 and Java 11 but not Java 8.
3.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.
3.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
3.4. 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.
3.5. Deprecated APIs and Components
All deprecated APIs and components from Camel 2.x have been removed in Camel 3.
3.5.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 useZooKeeperClusterService
or thecamel-zookeeper-master
component. -
The
camel-jetty
component no longer supports producer (which has been removed), usecamel-http
component instead. -
The
twitter-streaming
component has been removed as it relied on the deprecated Twitter Streaming API and is no longer functional.
3.5.2. Renamed components
Following components are renamed in Camel 3.x.
-
The
Camel-microprofile-metrics
has been renamed tocamel-micrometer
-
The
test
component has been renamed todataset-test
and moved out ofcamel-core
intocamel-dataset
JAR. -
The
http4
component has been renamed tohttp
, and it’s corresponding component package fromorg.apache.camel.component.http4
toorg.apache.camel.component.http
. The supported schemes are now onlyhttp
andhttps
. -
The
hdfs2
component has been renamed tohdfs
, and it’s corresponding component package fromorg.apache.camel.component.hdfs2
toorg.apache.camel.component.hdfs
. The supported scheme is nowhdfs
. -
The
mina2
component has been renamed tomina
, and it’s corresponding component package fromorg.apache.camel.component.mina2
toorg.apache.camel.component.mina
. The supported scheme is nowmina
. -
The
mongodb3
component has been renamed tomongodb
, and it’s corresponding component package fromorg.apache.camel.component.mongodb3
toorg.apache.camel.component.mongodb
. The supported scheme is nowmongodb
. -
The
netty4-http
component has been renamed tonetty-http
, and it’s corresponding component package fromorg.apache.camel.component.netty4.http
toorg.apache.camel.component.netty.http
. The supported scheme is nownetty-http
. -
The
netty4
component has been renamed tonetty
, and it’s corresponding component package fromorg.apache.camel.component.netty4
toorg.apache.camel.component.netty
. The supported scheme is nownetty
. -
The
quartz2
component has been renamed toquartz
, and it’s corresponding component package fromorg.apache.camel.component.quartz2
toorg.apache.camel.component.quartz
. The supported scheme is nowquartz
. -
The
rxjava2
component has been renamed torxjava
, and it’s corresponding component package fromorg.apache.camel.component.rxjava2
toorg.apache.camel.component.rxjava
. -
Renamed
camel-jetty9
tocamel-jetty
. The supported scheme is nowjetty
.
3.6. Changes to Camel components
3.6.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.
3.6.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
.
3.6.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
It is recommended to add specifc dependencies for these components.
3.6.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.
Old Namespace | New Namespace |
---|---|
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
.
3.6.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.
3.6.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.
3.6.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
3.6.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);
3.6.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.
3.6.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>
.
3.7. 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 thevalidate
androute-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.