W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
基于傳輸層之上,實(shí)現(xiàn) Request-Response 信息交換語(yǔ)義。
<dubbo:protocol exchanger="xxx" />
<!-- 缺省值設(shè)置,當(dāng)<dubbo:protocol>沒(méi)有配置exchanger屬性時(shí),使用此配置 -->
<dubbo:provider exchanger="xxx" />
org.apache.dubbo.remoting.exchange.exchanger.HeaderExchanger
Maven 項(xiàng)目結(jié)構(gòu):
src
|-main
|-java
|-com
|-xxx
|-XxxExchanger.java (實(shí)現(xiàn)Exchanger接口)
|-XxxExchangeServer.java (實(shí)現(xiàn)ExchangeServer接口)
|-XxxExchangeClient.java (實(shí)現(xiàn)ExchangeClient接口)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.remoting.exchange.Exchanger (純文本文件,內(nèi)容為:xxx=com.xxx.XxxExchanger)
XxxExchanger.java:
package com.xxx;
import org.apache.dubbo.remoting.exchange.Exchanger;
public class XxxExchanger implements Exchanger {
public ExchangeServer bind(URL url, ExchangeHandler handler) throws RemotingException {
return new XxxExchangeServer(url, handler);
}
public ExchangeClient connect(URL url, ExchangeHandler handler) throws RemotingException {
return new XxxExchangeClient(url, handler);
}
}
XxxExchangeServer.java:
package com.xxx;
import org.apache.dubbo.remoting.exchange.ExchangeServer;
public class XxxExchangeServer impelements ExchangeServer {
// ...
}
XxxExchangeClient.java:
package com.xxx;
import org.apache.dubbo.remoting.exchange.ExchangeClient;
public class XxxExchangeClient impelments ExchangeClient {
// ...
}
META-INF/dubbo/org.apache.dubbo.remoting.exchange.Exchanger:
xxx=com.xxx.XxxExchanger
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: