dtm-labs / dtm

A distributed transaction framework, supports workflow, saga, tcc, xa, 2-phase message, outbox patterns, supports many languages.
http://d.dtm.pub
BSD 3-Clause "New" or "Revised" License
10.17k stars 977 forks source link

用consul做dtm的服务发现可以吗? #384

Closed yb19890724 closed 1 year ago

yb19890724 commented 1 year ago

https://github.com/dtm-labs/quick-start-sample/blob/main/dtmgrpc-qs/main.go#L19 busi.DtmGrpcServer = localhost:36790 当前这行代码可以替换成对应consul的注册地址吗?还是必须是注册到consul的地址

这里看到这样配置是可以直接通过etcd获取地址直接去call dtm server https://github.com/nivin-studio/go-zero-mall/blob/dtm/service/order/api/internal/logic/createlogic.go#L44

我这块配置 consul中心的地址:这样可以支持服务发现吗? consul://locahost:8500/dtmservice

yb19890724 commented 1 year ago

遇到用consul的同学,需要服务发现需要导入 _ "github.com/dtm-labs/driver-gozero"

如果不导入这块默认会直接去请求grpc服务,而不会去consul的地址获取服务列表 busi.DtmGrpcServer := "consul://localhost:8500/dtmservice" saga := dtmgrpc.NewSagaGrpc(busi.DtmGrpcServer, gid)