Hello All,
I am new to the Camel world and need some help on creating expressions.  I
have the following route defined using Java DSL.

from("direct:jde")
  .setHeader("FMZ57FMR", simple("${body.fuelDistribution.quantity}"))
  .setHeader("FMZ57ST", simple("${body.fuelDistribution.sourceTank.state}"))
  .setHeader("FMZ57JOB", constant(null))
  .setHeader("FMZ57MISC1",
DateUtility.convertDateToKRC("${date:now:yyyy-MM-dd}"))
  .setHeader("FMZ57MISC2", simple("${date:now:yyyy-MM-dd}"))
  .to("sql:" + insertStmt.replaceAll("\t", " ") + "?dataSource=exampleds");

I have two questions. 

1. How do I make DateUtility.convertDateToKRC("${date:now:yyyy-MM-dd}") into
an Expression as required by the setHeader method.  DateUtility is a Java
class with static method convertDateToKRC. The method takes one string
argument.  The compiler is giving me the following error: 

The method setHeader(String, Expression) in the type
ProcessorDefinition<RouteDefinition> is not applicable for the arguments
(String, int)   InsertReadings.java
/LogPublish/src/main/java/FuelLog/LogPublish    line 33 Java Problem


2.  Is there an alternative to the expression:
simple("${body.fuelDistribution.sourceTank.state}")

Specifically I am looking for the cleanest way to retrieve items several
levels deep from a Java object in the body of the message.

Thanks for your help.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Java-Utility-Expression-tp5755447.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to