Responsible for monitoring service call counts and call times.
org.apache.dubbo.monitor.MonitorFactory
org.apache.dubbo.monitor.Monitor
<!-- Define the monitoring center -->
<dubbo:monitor address="xxx://ip:port" />
org.apache.dubbo.monitor.support.dubbo.DubboMonitorFactory
Maven project structure:
src
|-main
|-java
|-com
|-xxx
|-XxxMonitorFactory.java (implements the MonitorFactory interface)
|-XxxMonitor.java (implements the Monitor interface)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.monitor.MonitorFactory (text file, content: xxx=com.xxx.XxxMonitorFactory)
XxxMonitorFactory.java:
package com.xxx;
import org.apache.dubbo.monitor.MonitorFactory;
import org.apache.dubbo.monitor.Monitor;
import org.apache.dubbo.common.URL;
public class XxxMonitorFactory implements MonitorFactory {
public Monitor getMonitor(URL url) {
return new XxxMonitor(url);
}
}
XxxMonitor.java:
package com.xxx;
import org.apache.dubbo.monitor.Monitor;
public class XxxMonitor implements Monitor {
public void count(URL statistics) {
// ...
}
}
META-INF/dubbo/org.apache.dubbo.monitor.MonitorFactory:
xxx=com.xxx.XxxMonitorFactory