拦截路线而不跟踪

问题描述 投票:0回答:1

我工作的应用程序是一个中间件应用程序,允许吨的应用程序(主要是SOAP服务)之间的路由。我们遇到的,因为骆驼产生的自动日志的饱和度。

日志卷与新的拦截降低。但是,如果一个服务被称为当前路径里面,我的一切是从SendToEndpoint拦截请求主体。

考虑到应用程序中所有的服务电话是那种人,我不能改变当前的路线。

旧的拦截器:

            getContext().setTracing(true); // <--- trace every step of all routes
            interceptFrom().to("log:example");

            configureRoutes() {
            // route logic
            }

新的拦截器:

            getContext().setTracing(false);
            interceptFrom("cxf:*").to("log:example");
            interceptSendToEndpoint("cxf:*").to("log:example");

            configureRoutes() {
            // route logic
            }

路线的示例:

            from("scheduler endpoint")
                .to("DAO method to find the case from database")
                .process(//First processor to call the SOAP service)
                .to("SOAP endpoint")
                .convertBodyTo(SOAP ResponseBody.class) <-- convert the MessageContentsList to SOAP response body generated from the WSDL
                .process(//Second processor to check if the response code is OK in the SOAP response body);

我怎样才能实现一个拦截器,也可以登录SOAP响应体?

谢谢您的帮助。

apache-camel interceptor
1个回答
0
投票

我不喜欢用拦截这个海豚,我建议你使用事件通知接口,您只需要把它声明为在骆驼上下文中的豆及覆盖通知方法。

请参阅:https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/EventNotifier.html

下面是一个使用例如:http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html

注:骆驼有一些事件,你可以像号:CamelContextCreated,ExchangeCreatedEvent,ExchangeSendingEvent,ExchangeSentEvent,ExchangeCompletedEvent,ExchangeFailedEvent等。

© www.soinside.com 2019 - 2024. All rights reserved.