camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Message translator idea
Date Thu, 09 Aug 2007 10:54:53 GMT
On 8/9/07, Erik Allais <erik.allais@altervisions.com> wrote:
> Hi,
>
> i read that the Message translator pattern is used to translate one data
> format into another.
> I got a xml data format and i want to transform this document into a SQL
> query.
>
> I develop my own XQuery to transform the xml document.
> How i can i use this XQuery inside the Message translator?

You can use XQuery as a predicate or expression in any of the EIP
patterns you like.
http://activemq.apache.org/camel/xquery.html

So for example, using the Java DSL you could do something like

String xqueryCommand = ...;
from("file:myDirectory").setBody(xquery(xqueryCommand)).to("file:updatedFiles")

(BTW if you want to create the XQuery expression from a separate
file/URL thats fine too)

Let us know how you get on! It'd be good to create an example for
folks showing how to use XQuery with SQL to transform messages!

-- 
James
-------
http://macstrac.blogspot.com/

Mime
View raw message