LibraryToggle FramesPrintFeedback

DSL Changes

DSL changes

Table 1 provides an overview of the DSL commands that have been renamed in Apache Camel 2.0.

Table 1. Renamed DSL Commands

Old Java DSL NameOld Spring DSL NameNew DSL Name
splittersplittersplit
resequencerresequencerresequence
aggregatoraggregatoraggregate
delayerdelayerdelay
throttlerthrottlerthrottle
expressionexpressionlanguage
tryBlocktrydoTry
handlecatchdoCatch
finallyBlockfinallydoFinally
interceptinterceptinterceptFrom
threadthreadthreads

bean

(in SpringBuilder class)

 lookup
throwFault Removed

errorHandler changes

The following changes were made to the errorHandler DSL command in Apache Camel version 2.1:

  • In the Java DSL the, errorHandler DSL command can now be configured only on a route or a Camel context. In the case of routes, you must set it directly after the from DSL command.

  • In Spring DSL, the errorHandlerRef attribute is now available only on the camelContext and route elements.

adviceWith changes

Since Apache Camel version 2.3, the adviceWith() DSL command now takes CamelContext as its first argument.

onException changes

Since Apache Camel version 2.3, the Java DSL now requires onException (and similar clauses) to appear at the start of the route, otherwise Apache Camel will fail to start the route.

redeliveryPolicy changes

Since Apache Camel version 2.7, the ref attribute on the redeliveryPolicy element has been removed. Use the redeliveryPolicyRef attribute either on the onException element or on the errorHandler element, instead.

resequence changes

Since Apache Camel version 2.7, the batch-config element or the stream-config element, if present, must now appear as the first child element of the resequence element (in previous versions, they appeared as the last child element). For example, the stream-config element must now appear as follows inside a route:

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="direct:start"/>
    <resequence>
      <stream-config capacity="5000" timeout="4000"/>
      <simple>in.header.seqnum</simple>
      <to uri="mock:result" />
    </resequence>
  </route>
</camelContext>

sortBody removed

Since Apache Camel version 2.7, the sortBody() command has been removed from the Java DSL. Use sort(body()) instead.

sort changes

Since Apache Camel version 2.7, the expression in a Spring DSL sort element is no longer enclosed inside an expression element. For example, to sort the contents of the current message body, you must now specify the sort element as follows in the Spring DSL:

<sort>
  <simple>body</simple>
</sort>

Whereas the old sort syntax (prior to version 2.7) would have been:

<sort>
  <expression>
    <simple>body</simple>
  </expression>
</sort>

wireTap changes

Since Apache Camel version 2.8, when using the send-new-message mode, you can now specify headers directly in the Java DSL using the setExchangeHeader() clause. For example:

from("direct:start")
    .wireTap("direct:tap")
        // create the new tap message body and headers
        .newExchangeBody(constant("Bye World"))
        .newExchangeHeader("id", constant(123))
        .newExchangeHeader("date", simple("${date:now:yyyyMMdd}"))
    .end()

In the XML DSL, use the setHeader child element, as follows:

<route>
    <from uri="direct:start"/>
    <wireTap uri="direct:tap">
        <!-- create the new tap message body and headers -->
        <body><constant>Bye World</constant></body>
        <setHeader headerName="id"><constant>123</constant></setHeader>
        <setHeader headerName="date"><simple>${date:now:yyyyMMdd}</simple></setHeader>
    </wireTap>
    ...
</route>

Since Apache Camel 2.10, it is no longer possible to change the destination of the wire tap enterprise integration pattern from JMX.

throttle changes

Since Apache Camel version 2.8, in the XML DSL, the maximumRequestsPerPeriod attribute of the throttle element has been removed. You now specify the maximum requests per period using an expression that appears as a child of of the throttle element. For example, to throttle the message rate to a maximum of three messages every 10 seconds:

<route>
    <from uri="seda:a"/>
    <!-- throttle 3 messages per 10 sec -->
    <throttle timePeriodMillis="10000">
        <constant>3</constant>
        <to uri="mock:result"/>
    </throttle>
</route>

The advantage of using an expression here is that it enables you to specify the rate dynamically at run time.

bean, marshal, and unmarshal elements

Since Apache Camel version 2.8, in the XML DSL, the bean, marshal, and unmarshal elements are no longer permitted to have any child elements.

idempotentConsumer changes

Since Apache Camel version 2.8, the JDBC and JPA-based idempotent repositories now contain a createdAt column.

Removed clauses that use an expression builder

Since Apache Camel version 2.8, the following DSL methods, which used an ExpressionClause to build up an expression, have been removed:

aggregate(...).completionPredicate()
catch(...).onWhen()
idempotentConsumer(...).expression()
onCompletion(...).onWhen()
onException(...).onWhen()
idempotentConsumer()
split(...).expression()
try(...).onWhen()
expression() on WhenDefinition

Instead of building up the expression using an expression clause builder, you can use the form of DSL method that specifies the expression directly as an argument. For example:

aggregate(...).completionPredicate(body().isEqualTo("END"))...

convertBodyTo changes

Since Apache Camel 2.10, the convertBodyTo DSL command does not propagate the character set as an exchange property when the charset option is set (in previous releases, the character set was propagated in the Exchange.CHARSET_NAME property).

Comments powered by Disqus