You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Tomek (Jira)" <ji...@apache.org> on 2024/08/19 11:07:00 UTC
[jira] [Commented] (CAMEL-21096) interceptFrom with pattern specified are not executed
[ https://issues.apache.org/jira/browse/CAMEL-21096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17874850#comment-17874850 ]
Tomek commented on CAMEL-21096:
-------------------------------
I've downgraded Camel to version 4.4.3 (latest one from 4.* family), because the intercept changes were introduced within version 4.5 ([https://camel.apache.org/manual/camel-4x-upgrade-guide-4_5.html)]
It looks like everything works fine using 4.4.3
> interceptFrom with pattern specified are not executed
> -----------------------------------------------------
>
> Key: CAMEL-21096
> URL: https://issues.apache.org/jira/browse/CAMEL-21096
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 4.7.0
> Reporter: Tomek
> Priority: Major
>
> In our application we have a base rout builder class in which we would like to intercept all REST routes executions (REST requests)
>
> {code:java}
> public abstract class BaseRouteBuilder extends RouteBuilder {
> @Autowired
> protected RestInterceptorProcessor restInterceptorProcessor;
> @Override
> public void configure() throws Exception {
> interceptFrom("rest:.*")
> .process(restInterceptorProcessor);
> } {code}
> All our routes extend this class and are constructed like the code below:
>
>
> {code:java}
> @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")
> }{code}
> 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
> {code:java}
> private static void doInitInterceptors(
> CamelContext context, RouteDefinition route, List<ProcessorDefinition<?>> upper,
> List<InterceptDefinition> intercepts,
> List<InterceptFromDefinition> interceptFromDefinitions,
> List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions)
> {code}
> , but still my processor is not executed after REST request.
> Could you please check this issue?
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)