Hi David,

This is not possible without adding a processor behaving like a payload
transformer/replacer. The way to do this is

  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
    <route>
      <from uri="timer://myTimer?fixedRate=true&amp;period=2000"/>
      <process ref="MyBodyReplacementProcessor"/>
      <to uri="..."/>
    </route>
  </camelContext>

In myBodyReplacementProcessor

    public class MyBodyReplacementProcessor implements Processor {
        public void process(Exchange exchange) throws Exception {
            String payload = exchange.getIn().getBody(String.class);
            // do something with the payload and/or exchange here
           exchange.getIn().setBody("Changed body (XML Message)");
       }
    }


This should allow the body to be replaced by your XML messahe and sent to
the final URI.

Hope this helps.

Cheers,

Ashwin...
 

david_geary wrote:
> 
> I want to use a timer to call a web service so i need to set the xml body
> of the message. Im using the xml configuration so I know I can do this:
> 
> <route>
> <from uri="timer://myTimer?fixedRate=true&amp;period=2000"/>
> <setBody>
>       <simple>${in.body} World!</simple>
> </setBody>   
> <to uri=....>
> </route>
> 
> But how can i use this to set xml content? What's the correct syntax for
> this - or is there a better way to do it? Reading the content from a file
> would suit also.
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: 
http://www.nabble.com/Setting-initial-xml-content-for-timer-mesages-tp22201587p22231076.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.

Reply via email to