简体   繁体   中英

Apache Camel Restlet Producer Connector

I would like to use the new Connector strategy within Apache Camel 2.19.x to use the Restlet Producer to connect to a JasperServer instance on a scheduled basis to download certain reports.

Basically what I would like to do is convert the following:-

from("timer://runOnce?repeatCount=1&delay=5000") .setHeader(RestletConstants.RESTLET_LOGIN).simple("jasperadmin") .setHeader(RestletConstants.RESTLET_PASSWORD).simple("jasperadmin") .to("restlet:http://localhost:8181/jasperserver/rest_v2/reports/reports/interactive/MapReport.pdf?restletMethods=get").to("file:C:/tmp/camel")

to

from("jasper-server").to("file:C:/tmp/camel")

The problem is that the RestletComponent sets up the RestletConsumer by default and I am not sure how to set it into Producer mode using an component option or whether I should use the SchedulerComponent as my base and then somehow integrate the Restlet functionality into the component. Would it be better to use the HttpComponent as the base component instead?

I haven't really used RestletComponet, but I managed a similar route to yours using http4 Component like:

from("timer://").to("direct:http-endpoint");

to("direct:http-endpoint").to("restlet://...")

I believe this is what is described in Restlet Component docs

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