Browse Source

update httpdriver interface

pull/262/head
KuiLiao 4 years ago
parent
commit
bfae89afc4
  1. 15
      dtmsvr/trans_status.go
  2. 2
      go.mod
  3. 6
      go.sum

15
dtmsvr/trans_status.go

@ -174,17 +174,12 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa
}
func (t *TransGlobal) getBranchResult(branch *TransBranch) (string, error) {
branchUrl := branch.URL
// means use http driver, must resolve url
if strings.HasPrefix(branchUrl, dtmdriver.GetDriver().GetName()) {
curDriver := dtmdriver.GetDriver().(httpdriver.HttpDriver)
realUrl, err := curDriver.ResolveHttpService(branchUrl)
if err != nil {
return dtmcli.StatusFailed, err
}
branchUrl = realUrl
realUrl := branch.URL
// resolver http url.
if v, ok := dtmdriver.GetDriver().(httpdriver.HttpDriver); ok {
realUrl = v.ResolveHttpService(branch.URL)
}
err := t.getURLResult(branchUrl, branch.BranchID, branch.Op, branch.BinData)
err := t.getURLResult(realUrl, branch.BranchID, branch.Op, branch.BinData)
if err == nil {
return dtmcli.StatusSucceed, nil
} else if t.TransType == "saga" && branch.Op == dtmimp.OpAction && errors.Is(err, dtmcli.ErrFailure) {

2
go.mod

@ -14,7 +14,7 @@ require (
github.com/go-redis/redis/v8 v8.11.4
github.com/go-resty/resty/v2 v2.7.0
github.com/go-sql-driver/mysql v1.6.0
github.com/horseLk/dtmdriver-nacos v1.0.6
github.com/horseLk/dtmdriver-nacos v1.0.9
github.com/lib/pq v1.10.4
github.com/lithammer/shortuuid v2.0.3+incompatible
github.com/lithammer/shortuuid/v3 v3.0.7

6
go.sum

@ -297,10 +297,8 @@ github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/horseLk/dtmdriver-nacos v1.0.5 h1:M6RGpRHSOObkOl2KdIEfWbQCwsJI6OGJXvcWuozKMiY=
github.com/horseLk/dtmdriver-nacos v1.0.5/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ=
github.com/horseLk/dtmdriver-nacos v1.0.6 h1:u9Zxap0Q/w3DtoUyeLaalGn1MaMl7tD+ttAs7uSwYns=
github.com/horseLk/dtmdriver-nacos v1.0.6/go.mod h1:sLy9zEQ50isWNDbcxOXf50+PBdYfRTUpA4MUsr0uhPQ=
github.com/horseLk/dtmdriver-nacos v1.0.8 h1:/H0KVGBQlrHa0wzhuLfw7hMKf1+/WtMuhJ9JtUC5NPc=
github.com/horseLk/dtmdriver-nacos v1.0.8/go.mod h1:uJ6ZMW2tuRtbvNSJdG7ewsuoy9SEPHWkCH085igFtO8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=

Loading…
Cancel
Save