Hi Yeah, or if you use Camel 2.12 you can use data format component http://camel.apache.org/dataformat-component
And with the "dynamic to" http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html On Wed, Sep 18, 2013 at 12:22 PM, Tom Ellis <[email protected]> wrote: > In that same vein - how could I dynamically provide a data format to > use when unmarshalling? Would it be appropriate to implement a custom > data format and inside that create the correct data format and execute > as required, and then configure with something like: > > split.method(MyTokenBean.class, > "myTokenizeXML").streaming().unmarshal().custom("myDataFormat").. > > On 18 September 2013 10:37, Tom Ellis <[email protected]> wrote: >> Perfect, thanks Claus. >> >> On 18 September 2013 10:31, Claus Ibsen <[email protected]> wrote: >>> You can use a method call expression and call a method on a pojo. And >>> there use the tokenizexml language where you of course in java code >>> can compute the tag names. >>> >>> public static Expression myTokenizeXML(String data) { >>> // figure out the tag name >>> return TokenizeLanguage.tokenizeXML(tagName, xxx); >>> } >>> >>> split().method(MyTokenBean.class, "myTokenizeXML").streaming(). >>> >>> On Wed, Sep 18, 2013 at 11:07 AM, Tom Ellis <[email protected]> wrote: >>>> Hi Everyone, >>>> >>>> Is it possible to have a dynamic tagName parameter specified for the >>>> tokenizeXML function of the Tokenizer language? >>>> >>>> For example, say as part of a route I inspect a big incoming payload >>>> and determine that it is of type Orders, so wish to set my tagName as >>>> "order". However on the same route Parts could be sent, so I wish to >>>> tokenize based on the tagName "part". >>>> >>>> I was hoping that maybe I could build it using a Simple expression or >>>> something, e.g. >>>> >>>> from("file:inbox") >>>> .beanRef("inspectPayload") // adds payloadTag to the exchange header >>>> which is the tag name we wish to tokenize on >>>> .split().tokenizeXML("${in.payloadTag}").streaming() >>>> .to("activemq:queue:tags"); >>>> >>>> but from the code it seems that tokenizeXML uses the tagName specified >>>> to build the start and end tokens. >>>> >>>> Does anyone have any ideas on how I could do this without having to >>>> specify a route for each incoming type? >>>> >>>> Cheers, >>>> >>>> Tom >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> Red Hat, Inc. >>> Email: [email protected] >>> Twitter: davsclaus >>> Blog: http://davsclaus.com >>> Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
