2.3.2. 将代理配置为使用拦截器
先决条件
-
创建拦截器类并将其添加到代理的 Java 类路径中。您可以使用
<broker-instance-dir>/lib目录,因为它是类路径的一部分。
步骤
-
Open
<broker-instance-dir>/etc/broker.xml 将代理配置为在_
<broker-instance-dir>/etc/broker.xml中添加配置来使用拦截器如果拦截器用于传入信息,将其
类名称添加到删除拦截器列表中。<configuration> <core> ... <remoting-incoming-interceptors> <class-name>org.example.MyIncomingInterceptor</class-name> </remoting-incoming-interceptors> ... </core> </configuration>如果拦截器用于传出消息,将其
类名称添加到删除拦截器列表中。<configuration> <core> ... <remoting-outgoing-interceptors> <class-name>org.example.MyOutgoingInterceptor</class-name> </remoting-outgoing-interceptors> </core> </configuration>