简体   繁体   中英

Camel CXF REST: Setup then poll

The problem is simple but the implementation seems elusive. I want to send only once a few setup POSTs to a REST server and then begin polling every 5 seconds with GETs right afterward the POSTs was successful. What would the implementation for this look like in Camel Spring XML using the Camel CXFRS component? I don't want to write new code or a camel endpoint and would like to do this with the existing camel tools.

You could try something like below. For details on camel components refer to Apache camel documentation

<camelContext xmlns="http://camel.apache.org/schema/spring"
  <route id="abc" shutdownRoute="Default"   streamCache="true">
            <from uri="timer://foo?fixedRate=true&amp;period=100000" />
            <setHeader headerName="CamelHttpMethod">
                <constant>POST</constant>
            </setHeader>
            --setheader for Content-Type 
            <recipientList>
                <simple>https4://post url</simple>
            </recipientList>
            <log message="After Transmission " loggingLevel="DEBUG"
                logName="com.domain" />
            <recipientList>
                <simple>https4://get url</simple>
            </recipientList>
            --unmarshall
 </route>
</camelContext>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM