Dubbo3 消息派發(fā)擴(kuò)展

2022-04-22 11:53 更新

擴(kuò)展說(shuō)明

通道信息派發(fā)器,用于指定線程池模型。

擴(kuò)展接口

org.apache.dubbo.remoting.Dispatcher

擴(kuò)展配置

<dubbo:protocol dispatcher="xxx" />
<!-- 缺省值設(shè)置,當(dāng)<dubbo:protocol>沒(méi)有配置dispatcher屬性時(shí),使用此配置 -->
<dubbo:provider dispatcher="xxx" />

已知擴(kuò)展

  • org.apache.dubbo.remoting.transport.dispatcher.all.AllDispatcher
  • org.apache.dubbo.remoting.transport.dispatcher.direct.DirectDispatcher
  • org.apache.dubbo.remoting.transport.dispatcher.message.MessageOnlyDispatcher
  • org.apache.dubbo.remoting.transport.dispatcher.execution.ExecutionDispatcher
  • org.apache.dubbo.remoting.transport.dispatcher.connection.ConnectionOrderedDispatcher

擴(kuò)展示例

Maven 項(xiàng)目結(jié)構(gòu):

src
 |-main
    |-java
        |-com
            |-xxx
                |-XxxDispatcher.java (實(shí)現(xiàn)Dispatcher接口)
    |-resources
        |-META-INF
            |-dubbo
                |-org.apache.dubbo.remoting.Dispatcher (純文本文件,內(nèi)容為:xxx=com.xxx.XxxDispatcher)

XxxDispatcher.java:

package com.xxx;
 
import org.apache.dubbo.remoting.Dispatcher;
 
public class XxxDispatcher implements Dispatcher {
    public Group lookup(URL url) {
        // ...
    }
}

META-INF/dubbo/org.apache.dubbo.remoting.Dispatcher:

xxx=com.xxx.XxxDispatcher


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)