Intereceptor for REST API Camel

754 views Asked by At

In the camelcontext APIs are defined in the format <camel:from uri="rest:post:aaa> How can I write a common intereceptor for all the API REST request?

1

There are 1 answers

0
Opri On

Camel supports three kinds of interceptors:

  1. intercept that intercepts each and every processing step while routing an Exchange in the route.

  2. interceptFrom(String uri) that intercepts incoming Exchange in the route.

  3. interceptSendToEndpoint that intercepts when an Exchange is about to be sent to the given Endpoint.

There are several ways you can write interceptors for camel:

class CustomInterceptingRoute extends CustomRouteBuilder{
        void configure() {
            interceptFrom('rest:*')...
        }
    }