You need to take a look at polling consumer[1],
The consumer will wait for 1 seconds to send first request and try to send other requests to the REST Service every 0.5 seconds then.

[1]http://camel.apache.org/polling-consumer.html

On 11/8/10 2:22 PM, servicemix-user wrote:

hi
this is my sample route builder code.the below code is executed successfully
and shows the output of xml content.

public class TestCamel extends RouteBuilder{
     public static void main(String[] args) throws Exception {          
        CamelContext context = new DefaultCamelContext();
         context.addRoutes(new TestCamel());
         context.start();
         Thread.sleep(3000);
         context.stop();
     }
        @Override
        public void configure() throws Exception {              

from("http://localhost:8080/servicemix_sample/resources/record/1345";).process(new
Processor()
                 {                      
                    @SuppressWarnings("unchecked")
                    public void process(final Exchange exchange) throws
Exception {
                        String xmlvalue =
exchange.getIn().getBody(String.class);
                        System.out.println("Result-------"+xmlvalue);
                        }
                 });
         }
}

Problem:
  here i used REST webservice uri. while executing the program it will fetch
the uri and print the output of xml content more times in the client side
for the particular time period. when the thread.sleep time is increased it
will invoke the rest service more times. if i remove the  Thread.sleep(3000)
statement it cant write the result content. i want to get the XML output
content once. ie URI should call only one time.....

how to resolve this problem.
is thr any other way to solve this?
kindly help me.


--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Reply via email to