3.3.2. インターセプターを使用するためのブローカーの設定
前提条件
-
インターセプタークラスを作成し、そのクラス(およびその依存関係)をブローカーの Java クラスパスに追加します。
<broker_instance_dir>/lib
ディレクトリは、デフォルトでクラスパスに含まれているため、使用することができます。
手順
-
<broker_instance_dir>/etc/broker.xml
を開きます。 ブローカーがインターセプターを使用するように設定するには、
<broker_instance_dir>/etc/broker.xml
に設定を追加します。インターセプターが着信メッセージを対象としている場合は、その
class-name
をremoting-incoming-interceptors
のリストに追加します。<configuration> <core> ... <remoting-incoming-interceptors> <class-name>org.example.MyIncomingInterceptor</class-name> </remoting-incoming-interceptors> ... </core> </configuration>
インターセプターが発信メッセージを対象としている場合は、その
class-name
をremoting-outgoing-interceptors
のリストに追加します。<configuration> <core> ... <remoting-outgoing-interceptors> <class-name>org.example.MyOutgoingInterceptor</class-name> </remoting-outgoing-interceptors> </core> </configuration>