Hi By default Camel converts java.util.Date to a toString representation. That may be sufficient?
You can use a custom messageConverter http://camel.apache.org/jms Which allows you to implement logic how to map the message to/from JMS. You could maybe also use a interceptSendToEndpoint and convert all the java.util.Date headers to your format. http://camel.apache.org/intercept On Thu, Jul 28, 2011 at 3:52 PM, Jason Parr <[email protected]> wrote: > > I'm new to Camel so if this is the wrong mailing list my apologies. > > In our system we want to send a tibco rendezvous (TibRv) message (basically a > key/value message), Camel doesn't come with a TibRv component so we are going > to use JMS. Then use a bridge available within Tibco EMS to export the JMS > message onto TibRv. > > This works mostly fine but the problem is with dates. > > We have a camel route with a translator that turns our canonical pojo into a > java.util.Map which we then send as a JMS MapMessage. > > Route: > > from("file:src/data?noop=true") > .unmarshal(jaxb) > .transform().method("myTranslator") > .to("activemq:queue:nomura.fiet.stp.radial.trades?jmsMessageType=Map"); > > Class: > > public class MyTranslator { > public Map<String, Object> translate(Transaction tradeTransaction) {...} > > The map can hold java primatives and dates. Now a JMS MapMessage can't hold a > Date so I need to format any dates as a string. How is this based acheived in > Camel? I could just not put any dates into the map created during > transformation, but preformat them as strings. But this doesnt feel right as > the translator is worrying about the transport being JMS. > > I know Camel has plugable type convertors - can I use an existing one / > implement a new one that hides the transport date conversion? > > Thanks -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
