The echo test is used to detect whether the service is available. The echo test is performed according to the normal request process. It can test whether the entire call is smooth and can be used for monitoring.
https://github.com/apache/dubbo-samples/tree/master/dubbo-samples-echo
All services automatically implement the EchoService
interface, just cast any service reference to EchoService
to use it.
<dubbo:reference id="memberService" interface="com.xxx.MemberService" />
// remote service reference
MemberService memberService = ctx. getBean("memberService");
EchoService echoService = (EchoService) memberService; // Mandatory transformation to EchoService
// echo test availability
String status = echoService. $echo("OK");
assert(status. equals("OK"));