1

An example URI for my rest service is as follows:

http://xx.xx.xxx.xx:8080/myservice/service/encode?encrypt=true&payload=11/11/2013%207:59:15%20AM&ttl=10h

The service route I am using on the node with my service on it is as follows. This works fine. The route should bridge whatever we give it through to the service.

<route id="my-server">
  <from uri="fabric-camel:myClusterId:jetty:http://xx.xx.xxx.xx:8484/myservice/service?matchOnUriPrefix=true" />
  <to uri="jetty:http://xx.xx.xxx.xx:8080/myservice/service?bridgeEndpoint=true&amp;throwExceptionOnFailure=false" />
</route>

My trouble is with the client route. The time component is working fine but my efforts to append anything to the GET have failed. If I can figure out how to do this I can create any number of client examples.

<route id="fabric-client" errorHandlerRef="errorHandler">
  <from uri="timer://foo?fixedRate=true&amp;period=1000"/>
  <to uri="fabric-camel:myClusterId"/>
</route>

Can someone give me a leg up by converting the URI example above to Sprint DSL? I am hoping you can show me how to do it. From that I can figure out how to pass in variables.

pjc
  • 240
  • 5
  • 14
  • I found some promise from these links, still in the weeds. http://people.apache.org/~dkulp/camel/http.html and https://github.com/muellerc/camel-in-daily-use/blob/master/part-2/src/main/java/org/apache/cmueller/camel/sus/cidu/part1/PrepareRestRequest.java – pjc Sep 17 '14 at 21:46
  • Another link that holds promise. Still looking. http://camel.465427.n5.nabble.com/Setting-url-params-in-REST-call-with-Camel-td2257861.html – pjc Sep 17 '14 at 21:48

1 Answers1

2

Here is the answer to my syntax question.

    <route id="fabric-client" errorHandlerRef="errorHandler">
      <from uri="timer://foo?fixedRate=true&amp;period=1000"/>
      <setHeader headerName="CamelHttpPath">
        <simple>/encode?encrypt=true&amp;payload=11/11/2013%207:59:15%20AM&amp;ttl=10h</simple>
      </setHeader>
      <to uri="fabric-camel:myClusterId"/>
      <log message=">>> ${body}"/>
    </route>

This post was the key. http://camel.465427.n5.nabble.com/Setting-url-params-in-REST-call-with-Camel-td2257861.html Took a lot of Googling.

This reference might help other people it helped me; especially the side by side Java and Spring DSL. http://people.apache.org/~dkulp/camel/http.html I actually can't remember how I figured out how to map Exchange.HTTP_PATH to CamelHttpPath. I think I had to guess - getting late.

pjc
  • 240
  • 5
  • 14