Export Listener Extension

Export Listener Extension

Extension Description

This event is triggered when services are exposed.

Extension Interface

org.apache.dubbo.rpc.ExporterListener

Extension Configuration

<!-- Service export listener -->
<dubbo:service listener="xxx,yyy" />
<!-- Default listener for service export -->
<dubbo:provider listener="xxx,yyy" />

Known Extension

org.apache.dubbo.registry.directory.RegistryExporterListener

Extension Example

Maven project structure:

src
 |-main
    |-java
        |-com
            |-xxx
                |-XxxExporterListener.java (implements ExporterListener interface)
    |-resources
        |-META-INF
            |-dubbo
                |-org.apache.dubbo.rpc.ExporterListener (plain text file, content: 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