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

  1. <!-- Service export listener -->
  2. <dubbo:service listener="xxx,yyy" />
  3. <!-- Default listener for service export -->
  4. <dubbo:provider listener="xxx,yyy" />

Known Extension

org.apache.dubbo.registry.directory.RegistryExporterListener

Extension Example

Maven project structure:

  1. src
  2. |-main
  3. |-java
  4. |-com
  5. |-xxx
  6. |-XxxExporterListener.java (implements ExporterListener interface)
  7. |-resources
  8. |-META-INF
  9. |-dubbo
  10. |-org.apache.dubbo.rpc.ExporterListener (plain text file, content: xxx=com.xxx.XxxExporterListener)

XxxExporterListener.java:

  1. package com.xxx;
  2. import org.apache.dubbo.rpc.ExporterListener;
  3. import org.apache.dubbo.rpc.Exporter;
  4. import org.apache.dubbo.rpc.RpcException;
  5. public class XxxExporterListener implements ExporterListener {
  6. public void exported(Exporter<?> exporter) throws RpcException {
  7. // ...
  8. }
  9. public void unexported(Exporter<?> exporter) throws RpcException {
  10. // ...
  11. }
  12. }

META-INF/dubbo/org.apache.dubbo.rpc.ExporterListener:

  1. xxx=com.xxx.XxxExporterListener

Feedback

Was this page helpful?

Yes No

Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)