이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 32. Using Message Interceptors


Abstract

You can use low-level message interceptors to process messages before they are delivered to your endpoint's service implementation.
Important
The Java Business Integration components of Red Hat JBoss Fuse are considered deprecated. You should consider migrating any JBI applications to OSGi.

Overview

Interceptors are a low-level pieces of code that process messages as they are passed between the message channel and service's implementation. They have access to the raw message data and can be used to process SOAP action entries, process security tokens, or correlate messages. Interceptors are called in a chain and you can configure what interceptors are used at a number of points along the chain.

Configuring an endpoint's interceptor chain

A Apache CXF binding component endpoint's interceptor chain has four points at which you can insert an interceptor:
in interceptors
On consumer endpoints the in interceptors process messages when they are received from the external endpoint.
On provider endpoints the in interceptors process messages when they are received from the NMR.
in fault interceptors
The in fault interceptors process fault messages that are generated before the service implementation gets called.
out interceptors
On consumer endpoints the out interceptors process messages as they pass from the service implementation to the external endpoint.
On provider endpoints the out interceptors process messages as they pass from the service implementation to the NMR.
out fault interceptors
The out fault interceptors process fault messages that are generated by the service implementation or by an out interceptor.
An endpoint's interceptor chain is configured using children of its consumer element or provider element. Table 32.1, “Elements Used to Configure an Endpoint's Interceptor Chain” lists the elements used to configure an endpoint's interceptor chain.
Expand
Table 32.1. Elements Used to Configure an Endpoint's Interceptor Chain
NameDescription
inInterceptors Specifies a list of interceptors that process incoming messages.
inFaultInterceptors Specifies a list of interceptors that process incoming fault messages.
outInterceptors Specifies a list of interceptors that process outgoing messages.
outFaultInterceptors Specifies a list of interceptors that process outgoing fault messages.
Example 32.1, “Configuring an Interceptor Chain” shows a consumer endpoint configured to use the Apache CXF logging interceptors.

Example 32.1. Configuring an Interceptor Chain

<cxfbc:consumer ...>
  ...
  <cxfbc:inInterceptors>
    <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
  </cxfbc:inInterceptors>
  <cxfbc:outInterceptors>
    <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
  </cxfbc:outInterceptors>
  <cxfbc:inFaultInterceptors>
    <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
  </cxfbc:inFaultInterceptors>
  <cxfbc:outFaultInterceptors>
    <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
  </cxfbc:outFaultInterceptors>
</cxfbc:consumer>
Copy to Clipboard Toggle word wrap

Implementing an interceptor

You can implement a custom interceptor by extending the org.apache.cxf.phase.AbstractPhaseInterceptor class or one of its sub-classes. Extending AbstractPhaseInterceptor provides you with access to the generic message handling APIs used by Apache CXF. Extending one of the sub-classes provides you with more specific APIs. For example, extending the AbstractSoapInterceptor class allows your interceptor to work directly with the SOAP APIs.

More information

For more information about writing Apache CXF interceptors see the Apache CXF documentation.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat