Git Product home page Git Product logo

dtm's Introduction

license Build Status Coverage Status Go Report Card Go Reference

English

GO语言分布式事务管理服务

DTM是首款golang的开源分布式事务管理器,优雅的解决了幂等、空补偿、悬挂等分布式事务难题。在微服务架构中,提供了高性能和简单易用的分布式事务解决方案。

受邀参加**数据库大会分享多语言环境下分布式事务实践

亮点

  • 稳定可靠
    • 经过生产环境考验,单元测试覆盖率90%以上
  • 使用简单
    • 接口简单,开发者不再担心悬挂、空补偿、幂等各类问题,框架层代为处理
  • 跨语言
    • 可适合多语言栈的公司使用。协议支持http。方便go、python、php、nodejs、ruby各类语言使用。
  • 社区活跃
    • 任何问题都快速响应
  • 易部署、易扩展
    • 仅依赖mysql,部署简单,易集群化,易水平扩展
  • 多种分布式事务协议支持
    • TCC: Try-Confirm-Cancel
    • SAGA:
    • 可靠消息
    • XA

文档与介绍(更新中)

快速开始

安装

git clone github.com/yedf/dtm

dtm依赖于mysql

配置mysql:

cp conf.sample.yml conf.yml # 修改conf.yml

启动并运行saga示例

go run app/main.go saga

开始使用

使用

  // 具体业务微服务地址
  const qsBusi = "http://localhost:8081/api/busi_saga"
	req := &gin.H{"amount": 30} // 微服务的载荷
	// DtmServer为DTM服务的地址,是一个url
	saga := dtmcli.NewSaga("http://localhost:8080/api/dtmsvr").
		// 添加一个TransOut的子事务,正向操作为url: qsBusi+"/TransOut", 补偿操作为url: qsBusi+"/TransOutCompensate"
		Add(qsBusi+"/TransOut", qsBusi+"/TransOutCompensate", req).
		// 添加一个TransIn的子事务,正向操作为url: qsBusi+"/TransOut", 补偿操作为url: qsBusi+"/TransInCompensate"
		Add(qsBusi+"/TransIn", qsBusi+"/TransInCompensate", req)
	// 提交saga事务,dtm会完成所有的子事务/回滚所有的子事务
  err := saga.Submit()

完整示例

参考examples/quick_start.go

交流群

请加 yedf2008 好友或者扫码加好友,验证回复 dtm 按照指引进群

yedf2008

如果您觉得此项目不错,或者对您有帮助,请赏颗星吧!

其他语言客户端

python

客户端sdk(当前只支持TCC): https://github.com/yedf/dtmcli-python

示例: https://github.com/yedf/dtmcli-python-sample

node

客户端sdk(当前只支持TCC): https://github.com/yedf/dtmcli-node

示例: https://github.com/yedf/dtmcli-node-sample

谁在使用

常青藤爸爸 镜小二

dtm's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.