Posts

Showing posts with the label apache-camel

Camel component endpoints options for password is altered, how to prevent this?

Image
Clash Royale CLAN TAG #URR8PPP Camel component endpoints options for password is altered, how to prevent this? In Camel I am using the http4 component to make REST request on a remote server. The component documentation states that the credentials should be put in the options on the endpoint like this: https4://myremote.server.com/?authUsername=xxx&authPassword=yyy This was working well until someone put a password with a '+' character on another environment. We notice that the '+' character is transmitted as a space in the server which generates an error. By searching deeper in the Camel documentation we found a page explaining there is a "RAW" function to use like this: https4://myremote.server.com/?authUsername=xxx&authPassword=RAW(yyy) to keep the password unchanged. Unfortunately this function has only been introduced in the Camel 2.11 version and for the moment we are not planning to upgrade to ServiceMix 5.1.x. We are currently on serviceMix 4.5...

Using embedded jetty with camel-cxf

Image
Clash Royale CLAN TAG #URR8PPP Using embedded jetty with camel-cxf I have a couple of rest routes defined in my Camel project and now I'm trying to add a SOAP service to my project using the same jetty embedded server. I have something like this: restConfiguration() .component("jetty") .host("0.0.0.0") .port(8080) ; CxfEndpoint cxfEndpoint = new CxfEndpoint(); cxfEndpoint.setCamelContext(getContext()); cxfEndpoint.setServiceClass(TestService.class); cxfEndpoint.setAddress("http://0.0.0.0:8080/test"); from(cxfEndpoint) .log(LoggingLevel.INFO, log, "test"); When I try to run the application, I get this error message: Web server failed to start. Port 8080 was already in use. Look like it's trying to start 2 instances of Jetty using the same port and that's why it's failing. I would really like to make the cxf endpoint work with the embedded Jetty used for my other services. Is there any way to do that? ...

Calling Processor from Inside Bean

Image
Clash Royale CLAN TAG #URR8PPP Calling Processor from Inside Bean New to Camel, so maybe I'm misunderstanding how processors and beans should interact. We have some logging to a database that we want to do throughout a camel route. The idea was to do this in a processor. However, we'd also like to do this logging from w/in the beans. Is that possible? I know I could pass it back as a return field from the bean...but it is already passing back a return. A related question is how to pass that status, thinking it would be an exchange property or header. Basically I want something along the lines of processor class EventStatusProcessor implements Processor { @Override void process(Exchange exchange) throws Exception { // do some stuff, thinking this will be a header } } route from("direct:route1") .bean(doSomething, 'doSomething') .process(new EventStatusProcessor()) bean @Component @Slf4j class DoSomething{ ...