Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 7. Camel Migration Issues


Camel 2.17 Migration Issues for JBoss Fuse 6.3

JBoss Fuse 6.3 uses Camel 2.17. There are a number of changes in Camel 2.17 that have to be considered before upgrading to JBoss Fuse 6.3.
As part of the Camel CDI component refactoring:
  • The @ContextName qualifier no longer has a default empty value.
  • The CdiPropertiesComponent class has been removed, the standard PropertiesComponent can be used instead
There are changes to Camel 2.17 that must be considered before upgrading:
  • Removed camel-hbase as Karaf feature as it did not work well in OSGi
  • The Kafka component has been migrated to use the Java Kafka client instead of Scala. A consequence of this is that there may be migration efforts or code changes required when upgrading.
  • Fixed using statement.xxx options on the JDBC consumer would only be used in first poll.
  • Fixed HTTP and HTTP4 to keep trailing slash if provided in uri when calling remote HTTP service.
  • Fixed OnCompletion to keep any caught exception stored as property on the Exchange which allows to access that information to know if there was an exception during routing.
  • Fixed an issue with Bean component or Simple language with OGNL method call, would pick method with java.lang.Object type over a better suited method, when the method is overloaded.
  • When installing the camel feature in Apache Karaf, camel-spring is no longer installed by default. You need to install the camel-spring feature if you are using spring-dm on Karaf.
  • Removed camel-docker from karaf features as it does not work in OSGi
  • Some changes have been made in Rest DSL to adjust naming and types to the Swagger Spec 2.0
  • Any custom component that supports suspension in doSuspend/doResume should implement the new Suspendable marker interface, so Camel knows there is custom logic for suspension in the component.
  • Exchange and Message only output id in their toString method to avoid outputting any message details such as sensitive details from message bodies.
  • Upgraded camel-hbase to Hadoop 2.x and HBase 1.1.x
  • camel-mustache requires Java 8.
  • camel-jetty8 is deprecated and being removed in next release.
  • Moved some Camel tooling related dependencies (such as maven/plexus) from the Camel Parent BOM to the tooling BOM (to have them separated).
  • camel-amqp does not support 0.9 anymore.
  • camel-spring-integration feature has been removed from the Camel karaf.
  • The Mail component now requires to configure to, cc, and bcc using lower case keys, eg to=foo@bar.com, instead of To=foo@bar.com as previously.
  • The File consumer no longer probe the file content by default. See the option probeContentType for more details.
  • If using Bean or Class component and specifying additional parameters in the endpoint uri to configure on the bean, then these options should now be prefixed with bean., eg foo=123 is now bean.foo=123.
  • The Twitter delay option is changed from seconds to milli seconds by default, eg 10 should be 10000 to indicate 10 seconds. This is aligned how other components with delay option behaves.
  • The options attributeNames and messageAttributeNames on AWS-SQS is changed to a string type where you can separate multiple values using comma. Before the type was a Collection which was much harder to configure in the Camel uris.
  • Rest DSL is exposing the REST services using all local IP address (eg 0.0.0.0) by default, instead of the local IP address of the host.
  • The hbase component now require row mapping from the endpoint uri to be prefixed with row. as prefix.Before:
    family=info&qualifier=firstName&family2=birthdate&qualifier2=year.
    After:
    row.family=info&row.qualifier=firstName&row.family2=birthdate&row.qualifier2=year.
  • As part of the Camel CDI component refactoring, DeltaSpike is not used anymore for the sourcing of the configuration properties. This new version of the component is agnostic to any configuration sourcing mechanism and delegates that concern the application so that it can declare a custom PropertiesComponent bean whose sourcing is tailored to its need. DeltaSpike can still be used by the application by declaring a PropertiesComponent bean configured with a PropertiesParser relying on DeltaSpike. See the camel-example-cdi-properties example for more details.
  • The Kafka component has been migrated to use the Java Kafka client instead of Scala. As such there may be migration efforts or code changes that can affect users upgrading.
  • Improved Rest DSL when CORS enabled to process and return the configured CORS headers in the rest-dsl in all the supported Rest DSL components.
  • The options verb in the Rest DSL has been deprecated and are not in use if CORS is enabled.
  • You can set XStream's type permissions to automatically allow or deny the instantiation of certain types. The default type permissions setting used by Camel only allows types from java.lang and java.util packages. This setting can be changed by setting System property org.apache.camel.xstream.permissions. Its value is a string of comma-separated types. Allowed types are prefixed with '+', which is the default and can be omitted. Denied types are prefixed with '-'. Each type in the list may contain a wildcard character, '*'.
    For example,
    "-*,java.lang.*,java.util.*"
    indicates that all types except for java.lang.* and java.util.* classes are denied. If you set this value to an empty string, "", control is reverted to XStream's default type permissions handling.
    The type permissions setting can be extended at an individual XStream DataFormat instance by setting its type permissions property.
    <dataFormats>
                <xstream id="xstream-default" 
                 permissions="org.apache.camel.samples.xstream.*"/>
                 ...
    
  • camel-gae is deprecated and will be removed from Camel 2.18 onwards.
A known issue is that camel-guice cannot install in Apache Karaf.

Camel 2.16 Migration Issues for JBoss Fuse 6.3

There are also a number of updates to Camel 2.16 that may have an impact on upgrading to JBoss Fuse 6.3.
  • The dumpRoutesAsXml operation now preserves the property placeholder used in the route models.
  • setFaultBody and setFaultHeader behave similarly to setBody or setHeader respectively, by preserving existing headers/attachments by setting on existing IN or OUT message.
  • If using concurrent consumer on JMS endpoints for request/reply over JMS then you must use the new replyToConcurrentConsumers, replyToMaxConcurrentConsumers options to configure the values.
  • When the Aggregator2 is force completed the exchange property Exchange.AGGREGATED_COMPLETED_BY value has been changed from forceCompletion to force so its named like the other completion triggers.
  • Removed unsupported modules camel-web and camel-web-standalone.
  • Removed unsupported camel:dot functionality from camel:run plugin.
  • Removed unsupported camel-archetype-scala-component from maven archetypes.
  • The Maven coordinate for linkedin and olingo2 components has been changed to have groupId as just org.apache.camel.
  • If using MongoDB component, the option invokeGetLastError has been removed. If this funcitonality is needed, use an acknowledged WriteConcern when executing the write operation and then verify the correctness of the operation with the method wasAcknowledged() of WriteResult.
  • The Jing component now uses jing as schema name in uris, instead of rng or rnc. rng or rnc have been removed.
  • Swagger module now supports getting api-docs from multiple camel contexts in the JVM. The entry point at /api-docs now lists the contexts detected, and you need to append the context id in the path, eg /api-docs/myCamel
  • If using <contextScan> with Spring or Blueprint to filter RouteBuilder classes, then Camel will now by default only look for singleton beans. You can turn on the old behavior to include prototype scoped with the new option includeNonSingletons.
  • camel-vertx has been upgraded to vertx 3.0 which requires Java 8 at runtime.
  • camel-cdi is now using CDI 1.1 api - support for 1.0 has been dropped.
  • Content Enricher with enrich and pollEnrich now supports dynamic endpoint uris. Dynamic endpoint uris are computed using an expression that allows the use of values from the current Exchange. The Java DSL stays backwards compatible.
  • WireTap now supports dynamic endpoint uris. Dynamic endpoint uris are computed using an expression that allows the use of values from the current Exchange. The Java DSL stays backwards compatible. The Java DSL stays backwards compatible.
  • If you have explicitly configured the JMX statistics level to All then that option is now called Default.
  • The HTTP based consumers no longer include Camel headers in the responses by default.
  • Bindy is requires to be configured using class names instead of package names, as it now supports having multiple model classes in the same java packages.
  • Using CamelProxy now binds the method parameters to the message body/header using Camel annotations to define the binding rules. If no annotations are defined, the parameter is assumed to be the message body. You can turn this off to have the old behavior.
  • SJMS component has been aligned to bind between Camel Messages and JMS Messages in the same way as the JMS component does. This has caused some APIs and behavior to change.
  • DefaultExchangeHolder now only keeps primitive/String type headers/exchange properties (like JMS component) and filter out other types such as java instances (caught exception on exchange property is kept as well).
  • The Scala based Swagger (camel-swagger) is deprecated in favor of the new camel-swagger-java component.
  • The Camel Proxy (camel-proxy) component enables parameter binding by default from Camel 2.16 onwards. Existing code must either be changed to use parameter binding, or else you can explicitly disable parameter binding by calling binding(false) on the ProxyBuilder. For example:
    MyAuditService service = new ProxyBuilder(context).endpoint("jms:queue:foo").binding(false).build(MyAuditService.class);
    service.auditMessage("1234", "Hello World");

Apache Camel 2.16 API Breaking Changes

  • org.apache.camel.mode.LoadBalancerDefinition no longer implements org.apache.camel.processor.loadbalancer.LoadBalancer which is the runtime processor (this was never intended).
  • The ref attribute on <loadBalance> has been removed, as it has been deprecated for a long time.You should use a <customLoadBalancer> to refer to a custom load balancer.
  • The copy method on StreamCache now takes an Exchange as parameter.
  • Various APIs in camel-jms has been adjusted to support including the JMS session parameter - javax.jms.Session. These API changes are mostly internal facing and are not expected to affect end users.
  • The resourceUri and resourceRef attributes on <enrich> and <pollEnrich> have been removed as they now support a dynamic URIs computed from an Expression.
  • Various APIs from camel-http in the package org.apache.camel.component.http have been moved to the camel-http-common module in the package org.apache.camel.http.common, which means that you may need to change the imports.
  • Renamed All enum on org.apache.camel.ManagementStatisticsLevel to Default.
  • Added new boolean parameter to method on org.apache.camel.spi.ShutdownPrepared
  • Added configure method to allow configuring CamelContext on org.apache.camel.main.MainListener.
  • Renamed org.apache.camel.component.sjms.jms.KeyFormatStrategy to org.apache.camel.component.sjms.jms.JmsKeyFormatStrategy
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.