Apache Camel and CXF JAX-RS Rest Service(s) End Point Routing and Proxy Server

800 views Asked by At

I am new to Apache Camel and trying to solve following problem with routing:

I have CXF JAX-RS based REST Service implemented and deployed in same JVM (end-point).

I have another set of REST Services that is not within same Java Process it is in (python or any other Process but on same host).

We have unified port to access both services, for example,

Client call ----> HTTP Rest call (8080) -----> Jetty Server(8080) ---> Camel Route( if(“/java_api/” ----→ to(http://localhost:9090) else { to (http://localhost:9091 (OLD Services)}

    <cxf:rsServer id="javaRestServer" address="http://localhost:9090/java_api" 
    loggingFeatureEnabled="true" 
    serviceClass="…." >
    <cxf:providers>
        <ref bean="jaxbProvider" />
        <ref bean="jsonProvider" />
    </cxf:providers>
    <cxf:serviceBeans>
        <ref bean="myService"/>            
    </cxf:serviceBeans>
</cxf:rsServer>  

The problem with this approach is there is unnecessary http call for Java API(java_api) route since it is already locally hosted and I do not want to incur HTTP call.

This has been done to set-up all the CXF context can be set-up (this info given to me) and be able to server REST service.

So, my questions are:

1) Is there any way to setup route to call cxf local binding JAX-RS (direct call) rather then http call for Java API ?

2) How can I configure route such a way so HTTP Proxy headers (e.g X-Forwarded-For ) gets created and pass to old Service API ? Since, Java Layer is indeed acting as proxy server.

Thanks in advance for help !

0

There are 0 answers