Ce contenu n'est pas disponible dans la langue sélectionnée.
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 Copier lienLien copié sur presse-papiers!
Camel 3 supports 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):
2.2. Modularization of camel-core Copier lienLien copié sur presse-papiers!
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 Copier lienLien copié sur presse-papiers!
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 Copier lienLien copié sur presse-papiers!
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>
<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>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-component-starter</artifactId>
</dependency>
2.5. Multiple CamelContexts per application not supported Copier lienLien copié sur presse-papiers!
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 Copier lienLien copié sur presse-papiers!
All deprecated APIs and components from Camel 2.x have been removed in Camel 3.
2.6.1. Removed components Copier lienLien copié sur presse-papiers!
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-jibxcomponent. -
Removed
camel-boondataformat. -
Removed the
camel-linkedincomponent as the Linkedin API 1.0 is no longer supported. Support for the new 2.0 API is tracked by CAMEL-13813. -
The
camel-zookeeperhas its route policy functionality removed, instead useZooKeeperClusterServiceor thecamel-zookeeper-mastercomponent. -
The
camel-jettycomponent no longer supports producer (which has been removed), usecamel-httpcomponent instead. -
The
twitter-streamingcomponent has been removed as it relied on the deprecated Twitter Streaming API and is no longer functional.
2.6.2. Renamed components Copier lienLien copié sur presse-papiers!
Following components are renamed in Camel 3.x.
-
The
testcomponent has been renamed todataset-testand moved out ofcamel-coreintocamel-datasetJAR. -
The
http4component has been renamed tohttp, and it’s corresponding component package fromorg.apache.camel.component.http4toorg.apache.camel.component.http. The supported schemes are now onlyhttpandhttps. -
The
hdfs2component has been renamed tohdfs, and it’s corresponding component package fromorg.apache.camel.component.hdfs2toorg.apache.camel.component.hdfs. The supported scheme is nowhdfs. -
The
mina2component has been renamed tomina, and it’s corresponding component package fromorg.apache.camel.component.mina2toorg.apache.camel.component.mina. The supported scheme is nowmina. -
The
mongodb3component has been renamed tomongodb, and it’s corresponding component package fromorg.apache.camel.component.mongodb3toorg.apache.camel.component.mongodb. The supported scheme is nowmongodb. -
The
netty4-httpcomponent has been renamed tonetty-http, and it’s corresponding component package fromorg.apache.camel.component.netty4.httptoorg.apache.camel.component.netty.http. The supported scheme is nownetty-http. -
The
netty4component has been renamed tonetty, and it’s corresponding component package fromorg.apache.camel.component.netty4toorg.apache.camel.component.netty. The supported scheme is nownetty. -
The
quartz2component has been renamed toquartz, and it’s corresponding component package fromorg.apache.camel.component.quartz2toorg.apache.camel.component.quartz. The supported scheme is nowquartz. -
The
rxjava2component has been renamed torxjava, and it’s corresponding component package fromorg.apache.camel.component.rxjava2toorg.apache.camel.component.rxjava. -
Renamed
camel-jetty9tocamel-jetty. The supported scheme is nowjetty.
2.6.3. Mock component Copier lienLien copié sur presse-papiers!
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.6.4. ActiveMQ Copier lienLien copié sur presse-papiers!
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.6.5. AWS Copier lienLien copié sur presse-papiers!
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.
2.6.6. FHIR Copier lienLien copié sur presse-papiers!
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.6.7. Kafka Copier lienLien copié sur presse-papiers!
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.6.8. Telegram Copier lienLien copié sur presse-papiers!
The camel-telegram component has moved the authorization token from uri-path to a query parameter instead, e.g. migrate
telegram:bots/myTokenHere
telegram:bots/myTokenHere
to
telegram:bots?authorizationToken=myTokenHere
telegram:bots?authorizationToken=myTokenHere
2.6.9. JMX Copier lienLien copié sur presse-papiers!
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 an extension from CamelContext as follows:
ManagedCamelContext managed = camelContext.getExtension(ManagedCamelContext.class);
ManagedCamelContext managed = camelContext.getExtension(ManagedCamelContext.class);
2.6.10. XSLT Copier lienLien copié sur presse-papiers!
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.6.11. XML DSL Migration Copier lienLien copié sur presse-papiers!
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.7. Migrating Camel Maven Plugins Copier lienLien copié sur presse-papiers!
The camel-maven-plugin has been split up into two maven plugins:
camel-maven-plugin-
camel-maven-plugin has the
rungoal, 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-pluginhas thevalidateandroute-coveragegoals 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.