LibraryLink ToToggle FramesPrintFeedback

API Changes

The following changes have been made to the Java API:

ProducerTemplate

Since Apache Camel 2.0, the org.apache.camel.ProducerTemplate class has been refactored so that sendBody methods now return void for InOnly messaging. Use one of the requestBody methods for InOut messaging. See Producer and Consumer Templates in Programing EIP Components for more details.

Exchange

Since Apache Camel 2.0, all specializations of org.apache.camel.Exchange are now removed. You should now always use the org.apache.camel.impl.DefaultExchange type. After analyzing the how exchanges are used, it was realized that the specialized exchanges were not really necessary and by removing them we can avoid a lot of unnecessary copying and improve throughput.

One implication of this change is that Producer and Consumer types no longer use generic type declarations. For example, instead of referring to Producer<DefaultExchange> you can just refer to a plain Producer.

Exchange getFault() and setFault() methods

Since Apache Camel 2.0, the getFault() and setFault() methods are now removed from Exchange. Faults represent application specific errors and are recognized by some protocols. Consequently, it makes more sense to store a fault as the Out message in an exchange (accessed using getOut() and setOut()). The org.apache.camel.Message interface now exposes the boolean isFault() and setFault() methods that are used to identify Out messages that represent faults.

Because faults represent persistent errors (as opposed to exceptions, which represent transient errors), Camel does not try (as in previous versions) to recover from them (for example, the error handler does not trigger) unless handling faults as exceptions is explicitly enabled.

AggregationStrategy

Since Apache Camel 2.0, the following changes have been made to the implementation of org.apache.camel.processor.aggregate.AggregationStrategy:

  • The aggregate() method is now invoked on the very first exchange. For this first invocation, the oldExchange parameter is null.

  • The payload is now always stored in the In message when you do custom aggregation using this strategy interface.

Aggregator

Since Apache Camel 2.3, the aggregator has been re-implemented and some options have been replaced. In particular, the algorithms for determining batch completeness have changed significantly, so that the batchSize, outBatchSize, batchTimeout, and batchConsumer options are no longer supported. To understand the new mechanisms for completeness testing, it is recommended that you read Aggregator in Implementing Enterprise Integration Patterns.

CamelContext

Since Apache Camel version 2.1, the following changes have been made to the CamelContext class:

  • The shouldStartContext() method is replaced by the autoStartup() method.

  • The getLifecycleStrategy() method has been renamed getLifecycleStrategies() and now returns a java.util.List.

ManagementNamingStrategy

Since Apache Camel version 2.1, the org.apache.camel.spi.ManagementNamingStrategy has had methods renamed and method signatures changed in order to accomodate the JMX features in this release.

PollingConsumerPollStrategy

Since Apache Camel version 2.3, the begin() method from org.apache.camel.spi.PollingConsumerPollStrategy returns a boolean value, where true indicates that polling can now start, while false indicates that polling should be skipped.

RoutePolicy

Since Apache Camel version 2.3, the org.apache.camel.spi.RoutePolicy interface has the new method, onInit().

Message

Since Apache Camel version 2.3, the org.apache.camel.Message interface has the new method, removeHeaders().

DefaultComponent and DefaultEndpoint

Since Apache Camel version 2.3, the getExecutorService() and setExecutorService() methods have been removed from the org.apache.camel.impl.DefaultComponent and org.apache.camel.impl.DefaultEndpoint classes. To create a thread pool, use the ExecutorServiceStrategy object that is returned by the CamelContext.getExecutorServiceStrategy() method.

For full details of the new threading model, see Threading Model in Implementing Enterprise Integration Patterns.

GenericFile

Since Apache Camel version 2.3, the org.apache.camel.component.file.GenericFile class is no longer serializable (does not inherit from java.io.Serializable).

RouteDefinition

Since Apache Camel version 2.3, the adviceWith() method from org.apache.camel.model.RouteDefinition takes a CamelContext instance as its first parameter.

toAsync

Since Apache Camel version 2.4, the toAsync() DSL command has been removed. Asynchronous dispatch is now implemented directly (where appropriate) in specific Apache Camel components and DSL commands.

Policy

Since Apache Camel version 2.4, the org.apache.camel.spi.Policy interface has the new method, beforeWrap(). For quick migration of your Policy classes, simply add an empty method implementation.

onException

Since Apache Camel version 2.4, the retryUntil option on onException has been renamed to retryWhile, because this reflects the meaning of the option more accurately (it continues to retry while its argument is true).

Routing Slip

Since Apache Camel version 2.4, you can use either a string or an expression to specify the name of the routing slip header. The Spring DSL has changed, such that the headerName attribute is now replaced by the headerName child element. For example, to specify the name of the routing slip header to be myHeader, use an XML fragment like the following:

<route>
  <from uri="direct:a"/>
  <routingSlip ignoreInvalidEndpoints="true">
    <headerName>myHeader</headerName>
  </routingSlip>
</route>  
ProducerTemplate

Since Apache Camel version 2.4, all sendBody and requestBody methods from the ProducerTemplate class throw a CamelExecutionException, which wraps the original exception.

RouteBuilder

Since Apache Camel version 2.4, the simple and xpath expression builder methods are built into the RouteBuilder class. It is, therefore, no longer necessary to use static imports to access these languages. In your existing code, the Java compiler might complain, if you use static imports for simple and xpath. To fix this, just remove the static imports.

The following classes have been removed from the API:

org.apache.camel.processor.CompositeProcessor 
org.apache.camel.impl.ProducerTemplateProcessor 
org.apache.camel.impl.NoPolicy
org.apache.camel.spi.Provider
org.apache.camel.spring.handler.LazyLoadingBeanDefinitionParser 
org.apache.camel.spring.handler.ScriptDefinitionParser 
org.apache.camel.spring.remoting.SendBeforeInterceptor 
org.apache.camel.spring.spi.SpringConverters

The following classes have moved to a different Java package:

The following classes have been renamed: