You need to put the groovy script as a String value. Its not compiled
together with the java code.
You can try with the simple language to use the split method on a string eg
.simple("${properties:cool.foo.split(',')}")
As java.lang.String has the split method out of the box, that Camel
simple l
i tried but below is not working
// route
from("direct:start")
.setHeader("myList").groovy( simple(" ${properties:cool.foo} ")
).toString().split(",") )
.log("cid "+simple("${header.myList.size}"))
.to("direct:end"}");
i even tried below but groovy complain that
.setHeader("c
Make a method call where you create that array or use dynamic
languages like groovy with some inlined script.
On Wed, Nov 9, 2016 at 5:42 AM, imranrazakhan wrote:
> I tried following but it is not working as u expected
>
> // route
> from("direct:start")
> .setHeader("myList", simple(" ${pro
I tried following but it is not working as u expected
// route
from("direct:start")
.setHeader("myList", simple(" ${properties:cool.foo} ") })
.log("cid "+simple("${header.myList.size}"))
.to("direct:end"}");
Failed to invoke method: size on null due to:
org.apache.camel.component.be
I did some googling and i cannot find an exact example. But based on what i
see in the Simple and Properties pages, i am guessing that it might work
like Spring. So in your properties file try this:
cool.foos[0]=a
cool.foos[0]=b
cool.foos[0]=c
and in your DSL use:
" ${properties:cool.foos} "
I am using Java DSL.
--
View this message in context:
http://camel.465427.n5.nabble.com/How-to-convert-property-value-to-array-tp5789924p5789926.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Are you using spring? Creating arrays from properties is built in.
On Nov 8, 2016 3:07 PM, "imranrazakhan" wrote:
> HI,
>
> I want to convert value to array but couldn't get any idea from docs
>
> // properties
> cool.foo=a,b,c
>
>
> // route
> from("direct:start")
> .setHeader("myList", sim