Hello,
I am trying to translate the following Java DSL (This is the example from
2.10.4). The Java DSL works fine. But I after I translate to Spring DSL,
several things are not working as expected. Would someone please help?
================================Java DSL=======================
from("cxf:bean:reportIncident")
.convertBodyTo(InputReportIncident.class)
.setHeader(Exchange.FILE_NAME,
constant("request-${date:now:yyyy-MM-dd-HHmmssSSS}"))
.wireTap("file://target/inbox/")
.choice().when(simple("${body.givenName} == 'Claus'"))
.transform(constant(ok))
.otherwise()
.bean(new ReportIncidentImpl(), "doReportIncident")
.transform(constant(accepted)
);
===========================SPRING DSL===================
<camel:camelContext id="camel">
<camel:route>
<camel:from uri="cxf:bean:reportIncident" />
<camel:convertBodyTo
type="org.apache.camel.example.reportincident.InputReportIncident" />
<camel:setHeader headerName="${Exchange.FILE_NAME}">
<camel:constant>request-${date:now:yyyy-MM-dd-HHmmssSSS}</camel:constant>
</camel:setHeader>
<camel:wireTap
uri="file://target/inbox/"></camel:wireTap>
<camel:choice>
<camel:when>
<camel:simple>${body.givenName} ==
'Claus'</camel:simple>
<camel:transform>
<camel:constant>"OK"</camel:constant>
</camel:transform>
</camel:when>
<camel:otherwise>
<camel:transform>
<camel:constant>"Accepted"</camel:constant>
</camel:transform>
</camel:otherwise>
</camel:choice>
</camel:route>
</camel:camelContext>
===========================================================
Here are the things I did not translate propertly:
.choice().when(simple("${body.givenName} == 'Claus'"))
.transform(constant(ok))
NOT THE SAME AS:
<camel:choice>
<camel:when>
<camel:simple>${body.givenName} ==
'Claus'</camel:simple>
<camel:transform>
<camel:constant>"OK"</camel:constant>
</camel:transform>
</camel:when>
.setHeader(Exchange.FILE_NAME,
constant("request-${date:now:yyyy-MM-dd-HHmmssSSS}"))
NOT THE SAME AS:
<camel:setHeader headerName="${Exchange.FILE_NAME}">
<camel:constant>request-${date:now:yyyy-MM-dd-HHmmssSSS}
Thanks,
--Gary
--
View this message in context:
http://camel.465427.n5.nabble.com/Problem-from-Java-DSL-to-Spring-DSL-tp5732558.html
Sent from the Camel - Users mailing list archive at Nabble.com.