camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Anstey <jans...@gmail.com>
Subject Re: Velocity component use of org.apache.camel.velocity.resourceUri header
Date Tue, 21 Jul 2009 18:37:35 GMT
That header is actually what the camel-velocity component *sets* on the
message. You can't use it to dynamically configure the template.

To do that you'll probably need to create a custom bean that creates a
velocity endpoint and sends to it based on what template you need. Something
like

    public class MyBean {
        ProducerTemplate template;

        public void sendToNewTemplate(Exchange exchange) {
            if (template == null) {
                template = exchange.getContext().createProducerTemplate();
            }
            template.send("velocity:" + getNewTemplate(), exchange);
        }

        private String getNewTemplate() {
            return bla...;
        }
    }

should do it.

On Tue, Jul 21, 2009 at 3:24 PM, tide08 <sachin2_2k@yahoo.com> wrote:

>
> Can someone provide information on how to make use of
> org.apache.camel.velocity.resourceUri header for velocity component? As per
> document this should be templateName as String.
>
> I don't want to provide templateName in route but use the header mentioned
> above. But looks like templateName is required for route to be correct.
>
> from("direct:start")
> .to("velocity:testTemplate.vm")
>
> I tried providing dummy templateName in route and than set the
> org.apache.camel.velocity.resourceUri  header with actual template I want
> to
> use but it still uses the dummy template provided in route.
>
> Am I misunderstanding use for that header? Please help.
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Velocity-component-use-of-org.apache.camel.velocity.resourceUri-header-tp24592228p24592228.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

http://janstey.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message