dubbo:method

dubbo:method element

Method level configuration. The corresponding class: org.apache.dubbo.config.MethodConfig. This tag is a child tag of <dubbo:service> or <dubbo:reference>, for accuracy to method level.

PropertyCorresponding URL parameterTypeRequisiteDefaultEffectDescriptionCompatibility
namestringYidentifierMethod nameabove 1.0.8
timeout<metodName>.timeoutintN<dubbo:reference> timeoutperformance optimizationMethod call timeout(ms)above 1.0.8
retries<metodName>.retriesintN<dubbo:reference> retriesperformance optimizationInvoking retry times, exclude the first invoking. Set 0 to disable itabove 2.0.0
loadbalance<metodName>.loadbalancestringN<dubbo:reference> loadbalanceperformance optimizationLoad balancing strategy. Choices:random, roundrobin(polling), leastactive(invoking least active service)above 2.0.0
async<metodName>.asyncbooleanN<dubbo:reference> asyncperformance optimizationWhether invoke asynchronouslyabove 1.0.9
sent<methodName>.sentbooleanNtrueperformance optimizationGenerally used when async is true, and If true, indicate that the network has sent out dataabove 2.0.6
actives<metodName>.activesintN0performance optimizationThe max concurrency of per service method for each corresponding consumerabove 2.0.5
executes<metodName>.executesintN0performance optimizationThe maximum number of threads of per service method is limited- -. Only take effect when <dubbo:method> is <dubbo:service> child tagabove 2.0.5
deprecated<methodName>.deprecatedbooleanNfalseservice governanceWhether is deprecated method. Only take effect when <dubbo:method> is <dubbo:service> child tagabove 2.0.5
sticky<methodName>.stickybooleanNfalseservice governanceIf true, all methods on this interface use the same provider. If more complex rules are required, use routingabove 2.0.6
return<methodName>.returnbooleanNtrueperformance optimizationWhether need return value. Only take effect when async is true. If true, return future, or callback such as “onreturn” method. Otherwise, return null.above 2.0.6
oninvokeStringNperformance optimizationIntercept before invokeabove 2.0.6
onreturnStringNperformance optimizationIntercept after invokeabove 2.0.6
onthrowStringNperformance optimizationIntercept when catch exceptionabove 2.0.6
cache<methodName>.cachestring/booleanNservice governanceCache return result, and key is call parameters. Choices: lru, threadlocal, jcache and so onat least 2.1.0
validation<methodName>.validationbooleanNservice governanceWhether enable JSR303 standard annotation validationat least 2.1.0

For example:

<dubbo:reference interface="com.xxx.XxxService">
    <dubbo:method name="findXxx" timeout="3000" retries="2" />
</dubbo:reference>

Last modified December 22, 2020: clean up website (6e41905afa)