Search code examples
javaapache-cameljasperserver

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?


Solution

  • 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