Invoker Listener Extension

Invoker Listener Extension

Extension Description

This event is triggered when there is a service reference.

Extension Interface

org.apache.dubbo.rpc.InvokerListener

Extension Configuration

  1. <!-- Reference Service Listener -->
  2. <dubbo:reference listener="xxx,yyy" />
  3. <!-- Default Listener for Reference Services -->
  4. <dubbo:consumer listener="xxx,yyy" />

Known Extensions

org.apache.dubbo.rpc.listener.DeprecatedInvokerListener

Extension Example

Maven project structure:

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

XxxInvokerListener.java:

  1. package com.xxx;
  2. import org.apache.dubbo.rpc.InvokerListener;
  3. import org.apache.dubbo.rpc.Invoker;
  4. import org.apache.dubbo.rpc.RpcException;
  5. public class XxxInvokerListener implements InvokerListener {
  6. public void referred(Invoker<?> invoker) throws RpcException {
  7. // ...
  8. }
  9. public void destroyed(Invoker<?> invoker) throws RpcException {
  10. // ...
  11. }
  12. }

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

  1. xxx=com.xxx.XxxInvokerListener

Feedback

Was this page helpful?

Yes No

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