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
Related
It is possible to set client timeout via camel cxf uri options?
There is possibility to set cxf://someAddress?[options], where options can be properties.XXX.
It is possible to set somehow http client receive timeout?
I tried many of them (found in source code or via google), but no one works:
properties.com.sun.xml.ws.request.timeout
properties.com.sun.xml.internal.ws.request.timeout
properties.javax.xml.ws.client.receiveTimeout
properties.org.apache.cxf.jms.client.timeout
properties.org.apache.cxf.transport.http.async.SO_TIMEOUT
properties.conduit.client.ReceiveTimeout
properties.org.apache.cxf.transports.http.configuration.client.ReceiveTimeout
properties.http-conf:client.ReceiveTimeout
properties.HTTPClientPolicy.ReceiveTimeout
properties.org.apache.cxf.http.conduits.client.ReceiveTimeout
properties.org.apache.cxf.http.conduit.client.ReceiveTimeout
properties.org.apache.cxf.transports.http.configuration.HTTPClientPolicy.ReceiveTimeout
I know it is possible with sprinx xml, but I want it configurable via Talend context.
I also know that I can configure cxf client via CxfEndpointConfigurer bean, but camel 2.13 (upgrade is not possible) does not have configureClient method.
Thank you for answer.
As mentioned in this document you can configure HTTP Client to set timeout
<http-conf:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
<http-conf:client Connection="Keep-Alive"
MaxRetransmits="1"
AllowChunking="false"
ConnectionTimeout="60000"
ReceiveTimeout="60000"/>
</http-conf:conduit>
Maybe you need to use a RouteBuilder, use the java variable in your route.
Tyr do something like this:
from("cxf://someAddress?[options]?timeout=${yourTimeOutVariable}")
I have to change the namespace of the incoming messages to our webservice.
The consumer route looks like the following:
from("cxf:/myservice?serviceClass=myServiceClass")...
I've tried to add somehow an interceptor to this(parameter properties.in, properties.inInterceptors?), but I don't get it how to configure it to my route.
We are not configuring our cxf endpoints in spring so I have to solve it with additional parameters to the route.
I think an interceptor with the transformation feature mentioned in the cxf documentation is the right solution, but I was not able to configure it correctly.
How can I add an interceptor to the route?
Or is there another way to change the namespace of the incoming message?
kind regards,
soilworker
I've found a solution:
It is possible to say something like from(endpoint), so I've created an instance of CxfEndpoint and there I can set the cxfEndpointConfigurer.
In this configurer I can add an interceptor which removes the namespace(see transformation feature of cxf).
Maybe it also works somehow with the from(uri) syntax, but I don't know how.
Im developping non OSGI app and i need to update the values of some properties used in camel routes (loaded BridgePropertyPlaceHolder).
So I thought:
To use Hawtio, the cool mangement console, in order update camel using JMX
Create a JMX MBean that will update the properties ..
I successfully create the MBean operations and call them using JMX, but I can't figure out how to update the camel routes that depends on these properties.
Is there a way to update the camel context externally?
Update:
Exemple of use case:when a remote server doesn't return response, we keep sending messages until we reach the max of unsuccessful attempt(messages without ack).
in camel we create a router pattern based on property loaded from file system.
This property can change occasionally, and we want to do this without restarting server, but the problem is that camel parse routes when starting context and i can't find no mean to update routes accordingly.
I am grateful for any proposal that could help:)
If you use Camel error handling to retry (redeliver) then you can use the retryWhile to keep retrying until you return false. This allows you to use java code etc, and that allows you to read the updated configuration option.
See more details at
http://camel.apache.org/exception-clause.html
And if you have a copy of Camel in Action book, see page 152
For what properties you want them to be dynamic.you can move those prop to some db and fetch them whenever you are reading.I think a redesign is required for your camel route.
Changing from endpoint parameters such as URLs etc., following procedure has to be used according to dynamic change endpoint camel:
stop the route
remove the route
change the endpoint
add the route
start the route
If the to endpoint has to be configurable, you may use the recipient list component. Here you may read properties from a database and/or from the filesystem using the appropriate Camel component.
I would like to add few more attributes to the existent JMX Apache Camel route attributes. Is there a way of doing this either using Spring or Java code?
And to answer your question. No the routes mbean are not extensible.
Though if you build custom components you can annotate your component with JMX annotations to have JMX operations and attributes enlisted out of the box. But this is only for components, and not the standard route, camelcontext, mbeans etc.
See details at: http://camel.apache.org/camel-jmx.html
I try to enable NCSA request logging in pax-web 1.1.4. The recommended way to do it doesn't work. The file was created but it stays empty. Looking in source code I found that pax web implementation of Jetty server passes requests to JettyServerHandlerCollection which assumes that every handler should correspond a context. So it looks impossible for me just to use org.ops4j.pax.web.log.ncsa.* options.
Am I missing something or this functionality doesn't work in pax web? Are there any workarounds?
Yep, it's a bug in Pax-Web and has been filed on PAXWEB-416