The events oninvoke
, onreturn
, and onthrow
will be triggered before a call, after a call, and when an exception occurs, respectively. You can configure which class and method to notify when these events happen.
Before calling the service method, we can log the start time, after the call, calculate the total time consumed, and in case of exceptions, we can trigger alerts or print error logs, or log request and response logs before and after the service call.
Reference Case dubbo-samples-notify
The following combinations exist:
async=true onreturn="xxx"
async=false onreturn="xxx"
async=true
async=false
callback
and async
functionalities are orthogonally decomposed, where async=true
indicates whether the result returns immediately, and async=false
is default, while onreturn
indicates whether a callback is needed.