Seata客戶端使用配置中心

2021-09-27 11:59:25 字數 1599 閱讀 1166

核心類:io.seata.config.configurationfactory static {}初始化current_file_instance

載入registry(環境隔離)

ps:使用nacos做配置中心時,如果namespace是public應該這麼配置namespace = 「」

獲取tmrpcclient例項

初始化nettyclientconfig

從中獲取與nettyclientconfig類相關的配置有

transport.thread-factory.client-selector-thread-size

transport.thread-factory.client-selector-thread-prefix

transport.thread-factory.client-worker-thread-prefix

transport.thread-factory.worker-thread-size

transport.type

transport.server

transport.heartbeat

# rpc通訊配置

transport.serialization

transport.compressor

啟動客戶端與相關定時器

獲取是否降級配置service.enabledegrade

初始化netty的bootstrap

啟動定時重連定時器(連線seata-server)

啟動合併訊息定時器,並執行合併訊息任務()

核心類:io.seata.discovery.registry.registryfactory#getinstance()獲取註冊中心例項

先從物件中registry.type的value

通過service..grouplist查詢ip:port列表用;分隔

通過ip:port連線seata-server

如果本地快取中存在對應的ip:port列表,直接進行3.3步

不存在

建立nacos的naminginstance

讀取nacos serveraddr, 先從system.getproperty的value 為null則從物件中讀取registry.nacos.serveraddr的value

讀取namespce, 先從system.getproperty的value 為null則從物件中讀取registry.nacos.namespace的value

獲取所有的server例項

根據serveraddr(這裡就是乙個字串)和請求nacos server獲取所有的seata-server ip:port列表,並快取到本地

開啟nacos的subscribe監聽,重新整理

通過ip:port連線seata-server

優先從system.getproperty中讀取,讀取不到再從對應的配置類中讀取。

獲取rmrpcclient例項

設定資源管理器(resourcemanager)

設定客戶端訊息***

連線seata-server(與tm相同)

Spring Cloud 配置中心客戶端讀取配置

微服務連線配置中心來實現外部配置的讀取。org.springframework.cloud spring cloud starter eureka org.springframework.cloud spring cloud starter config org.springframework.bo...

seata 配置中心使用 nacos

在上篇筆記中 seata 的配置中心使用的是 file 也就是本地配置檔案方式,現在修改為 nacos 配置中心方式。1 修改 registry.conf 配置檔案中的 config.type 修改為 nacos 並修改nacos中的配置。配置檔案如下 config 2 將seata 需要的配置資訊...

客戶端配置 Git客戶端基本配置

git 能夠識別的配置項被分為了兩大類 客戶端和伺服器端,其中大部分基於你個人工作偏好,屬於客戶端配置。儘管有數不盡的選項,但我只闡述 其中經常使用或者會對你的工作流產生巨大影響的選項,如果你想觀察你當前的 git 能識別的選項列表,請執行 git config helpgit config的手冊頁...