当有服务暴露时,触发该事件。
org.apache.dubbo.rpc.ExporterListener
<!-- 暴露服务监听 -->
<dubbo:service listener="xxx,yyy" />
<!-- 暴露服务缺省监听器 -->
<dubbo:provider listener="xxx,yyy" />
org.apache.dubbo.registry.directory.RegistryExporterListener
Maven 项目结构:
src
|-main
|-java
|-com
|-xxx
|-XxxExporterListener.java (实现ExporterListener接口)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.rpc.ExporterListener (纯文本文件,内容为:xxx=com.xxx.XxxExporterListener)
XxxExporterListener.java:
package com.xxx;
import org.apache.dubbo.rpc.ExporterListener;
import org.apache.dubbo.rpc.Exporter;
import org.apache.dubbo.rpc.RpcException;
public class XxxExporterListener implements ExporterListener {
public void exported(Exporter<?> exporter) throws RpcException {
// ...
}
public void unexported(Exporter<?> exporter) throws RpcException {
// ...
}
}
META-INF/dubbo/org.apache.dubbo.rpc.ExporterListener:
xxx=com.xxx.XxxExporterListener