Hello, 

I wanted to provide a solution for anyone else who may have the same
questions.  I also had a similar requirement where I create several data
formats via blueprint but I wanted a way for the route to determine which
data format to use.  That is, use a property value to determine the data
format name.  There is a component named "dataformat:" which is not
documented very well.  I was able to use the 'recipientList' and dataformat
component to do this as follows:

from("direct-vm:moxy-marshal")
        .choice()
        .when(simple("${property.moxyDataFormat} == null"))
                .throwException(new ExpressionIllegalSyntaxException("no 
property"))
        .otherwise()
                
.recipientList(simple("dataformat:${property.moxyDataFormat}:marshal"))
;

from("direct-vm:moxy-unmarshal")
        .choice()
        .when(simple("${property.moxyDataFormat} == null"))
                .throwException(new ExpressionIllegalSyntaxException("no 
property"))
        .otherwise()
                
.recipientList(simple("dataformat:${property.moxyDataFormat}:unmarshal"))
;




--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamic-data-format-in-route-tp5726853p5776681.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to