Why not use unmarshall EIP before passing the body to velocity template? Then, as per the velocity component, you would access your body via $body variable.
On Mon, Jan 6, 2020 at 3:19 PM Alex Dettinger <aldettin...@gmail.com> wrote: > > Hi Gerald, > > The example below shows how to use a pojo from a velocity context: > > https://github.com/apache/camel/blob/master/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityBodyAsDomainObjectTest.java > > So, chances are that you just need to set the body to a pojo offering a > getName() method and then use it from the velocity context with $body.name. > This is not something I've tested, but looks worth a try. > > Alex > > On Mon, Jan 6, 2020 at 12:54 PM Gerald Kallas <catsh...@mailbox.org> wrote: > > > Dear community, > > > > I've following snippet .. > > > > > > <setBody><constant>[{"name":"Wonderland","surname":"Alice"}]</constant></setBody> > > <to uri="velocity:file:{{karaf.etc}}/file.vm?contentCache=true" /> > > > > The body comes from a jsonpath expression earlier. I've just stripped it > > to the essentials. > > > > Is it possible to access inside a Camel Velocity component template to the > > attribute values for name and surname? > > > > Many thanks for any response in advance. > > > > Best > > - Gerald