title: Consuming a RESTful web service using Apache Camel
body: <p>I am trying to consume a restful Web service using camel.</p>
  
  <p>For that I am configuring dynamic endpoint url as the RESTful url is created at the runtime. Everytime I am checking if the particular endpoint url is registered as a route in my camel context using following method of CamelContext class.</p>
  
  <p>Endpoint hasEndpoint(String uri);</p>
  
  <p>In this case, if the endpoint is not registered then I add a route to my camel context using a custom Route Builder.</p>
  
  <p>I am using camel HTTP component for this. This is working fine for me as of now.</p>
  
  <p>However, I believe performance wise this is not good as everytime I have to check if a route is registered with the camel context and if not then register the same before making the webservice call.</p>
  
  <p>Can some body please tell me if there is a better way to consume RESTful Web services in camel?</p>
  
  <p>I also want to know if the RESTful webservice I am consuming uses OAuth 2.0 protocol, do I need to change anything in my code as I am just consuming it?</p>
  
  <p>Regards, Nilotpal</p>
  
  <hr>
  
  <p>Thanks for your reply.</p>
  
  <p>I am checking if the route is already exists to make sure I don't end up adding duplicate route(s) to the camel context. </p>
  
  <p>Regarding long lived routes and route dynamics, can u please explain a bit regarding this? How do I implement route dynamics?</p>
  
  <p>It would also be helpful if you could point me to some CXF-RS producer example.. I read the documentation of CXFRS but could not understand it clearly.</p>
  
  <p>Thanks
  Nilotpal</p>