Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21096

interceptFrom with pattern specified are not executed with rest-dsl

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.5.0, 4.6.0, 4.7.0
    • 4.8.0
    • camel-core
    • None
    • Unknown

    Description

      In our application we have a base rout builder class in which we would like to intercept all REST routes executions (REST requests)

       

      public abstract class BaseRouteBuilder extends RouteBuilder {
      @Autowired
      protected RestInterceptorProcessor restInterceptorProcessor;
      
      @Override
      public void configure() throws Exception {
          interceptFrom("rest:.*")
                  .process(restInterceptorProcessor);
      } 

      All our routes extend this class and are constructed like the code below:

       

       

      @Component
      public class MySampleRestCamelRestComponent extends BaseRouteBuilder { 
      @Override
      public void configure() throws Exception {
          super.configure();
      
          rest("/api/v1/some-endpoint")
                      .consumes(MediaType.APPLICATION_JSON_VALUE)
                      .produces(MediaType.APPLICATION_JSON_VALUE)
                      .get("/objects")
                          .id("getObjects")
                          .to("direct:rest-fetch-objects")
      }

      This approach worked fine in Camel 3., but in Camel 4. my processor is not executed.

      I've made some investigation and:

      • when we skip the pattern and just use interceptFrom().process(restInterceptorProcessor) - the processor is executed on REST request, but also for other requests like f.e. seda:
      • when I've debugged Camel source code while using the rest:* or rest:.* patterns, the URI matcher returns true (URI start with "rest://get://api/v1/some-endpoint" etc.) within the class org.apache.camel.model.RouteDefinitionHelper / method
      private static void doInitInterceptors(
                  CamelContext context, RouteDefinition route, List<ProcessorDefinition<?>> upper,
                  List<InterceptDefinition> intercepts,
                  List<InterceptFromDefinition> interceptFromDefinitions,
                  List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions)
       

      , but still my processor is not executed after REST request.

      Could you please check this issue?

       

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              Tomasz Seweryński Tomek
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: