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 Name | Old Spring DSL Name | New DSL Name |
|---|---|---|
splitter | splitter | split |
resequencer | resequencer | resequence |
aggregator | aggregator | aggregate |
delayer | delayer | delay |
throttler | throttler | throttle |
expression | expression | language |
tryBlock | try | doTry |
handle | catch | doCatch |
finallyBlock | finally | doFinally |
intercept | intercept | interceptFrom |
thread | thread | threads |
|
(in | lookup | |
throwFault | Removed |
The following changes were made to the errorHandler DSL command in Apache Camel
version 2.1:
In the Java DSL the,
errorHandlerDSL command can now be configured only on a route or a Camel context. In the case of routes, you must set it directly after thefromDSL command.In Spring DSL, the
errorHandlerRefattribute is now available only on thecamelContextandrouteelements.
Since Apache Camel version 2.3, the adviceWith() DSL command now takes
CamelContext as its first argument.
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.
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.
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>Since Apache Camel version 2.7, the sortBody() command has been removed from
the Java DSL. Use sort(body()) instead.
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>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.
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.
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.
Since Apache Camel version 2.8, the JDBC and JPA-based idempotent repositories now contain a
createdAt column.
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"))...







