2.3.2. インターセプターを使用するためのブローカーの設定

前提条件

  • インターセプタークラスを作成し、そのクラス(およびその依存関係)をブローカーの Java クラスパスに追加します。デフォルトではクラスパスの一部であるため、<broker-instance-dir>/lib ディレクトリーを使用できます。

手順

  1. Open <broker-instance-dir>/etc/broker.xml
  2. _<broker-instance-dir>/etc/broker.xml に設定を追加して、インターセプターを使用するようにブローカーを設定します。

    1. インターセプターが着信メッセージを対象としている場合は、そのclass-nameremoting-incoming-interceptors のリストに追加します。

      <configuration>
        <core>
          ...
          <remoting-incoming-interceptors>
             <class-name>org.example.MyIncomingInterceptor</class-name>
          </remoting-incoming-interceptors>
          ...
        </core>
      </configuration>
    2. インターセプターが発信メッセージを対象としている場合は、そのclass-nameremoting-outgoing-interceptorsのリストに追加します。

      <configuration>
        <core>
          ...
          <remoting-outgoing-interceptors>
             <class-name>org.example.MyOutgoingInterceptor</class-name>
          </remoting-outgoing-interceptors>
        </core>
      </configuration>