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

前提条件

  • インターセプタークラスを作成し、そのクラス(およびその依存関係)をブローカーの Java クラスパスに追加します。<broker_instance_dir>/libディレクトリは、デフォルトでクラスパスに含まれているため、使用することができます。

手順

  1. <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>