All Projects → dtm-labs → dtm

dtm-labs / dtm

Licence: BSD-3-Clause license
A distributed transaction framework that supports multiple languages, supports saga, tcc, xa, 2-phase message, outbox patterns.

Programming Languages

go
31211 projects - #10 most used programming language
Vue
7211 projects
typescript
32286 projects
shell
77523 projects
javascript
184084 projects - #8 most used programming language
Smarty
1635 projects

Projects that are alternatives of or similar to dtm

dtmcli-php
a php client for distributed transaction framework dtm.
Stars: ✭ 26 (-99.57%)
Mutual labels:  transaction, distributed, distributed-transactions, tcc, saga, seata
Seata
🔥 Seata is an easy-to-use, high-performance, open source distributed transaction solution.
Stars: ✭ 21,351 (+249.44%)
Mutual labels:  xa, tcc, saga, seata
Easytransaction
A distribute transaction solution(分布式事务) unified the usage of TCC , SAGA ,FMT (seata/fescar AutoCompensation), reliable message, compensate and so on;
Stars: ✭ 2,284 (-62.62%)
Mutual labels:  transaction, tcc, saga
Workflow Core
Lightweight workflow engine for .NET Standard
Stars: ✭ 3,605 (-41%)
Mutual labels:  workflow-engine, saga
Go Saga
Implements saga-pattern in Go, another way to distribute transaction.
Stars: ✭ 183 (-97%)
Mutual labels:  transaction, distributed-transactions
Reliable
mq transaction, tcc, eventually consistency. tx life cycle: all listeners handled, if necessary, produce next message
Stars: ✭ 187 (-96.94%)
Mutual labels:  transaction, tcc
Nem Apps Lib
Semantic Java API Library for NEM Platform
Stars: ✭ 16 (-99.74%)
Mutual labels:  transaction, transactions
kunlun-storage
Kunlun-storage is the storage component for KunlunBase. It's developed based on percona-mysql-8.0.x and contains exclusive features used by KunlunBase, performance enhancements and XA transaction crash safety enhancements without which MySQL would not be able to execute XA transactions reliably under error conditions such as power outage, proces…
Stars: ✭ 2 (-99.97%)
Mutual labels:  transaction, xa
Odin
A programmable, observable and distributed job orchestration system.
Stars: ✭ 405 (-93.37%)
Mutual labels:  workflow-engine, distributed
KuiBaDB
Another OLAP database
Stars: ✭ 297 (-95.14%)
Mutual labels:  transaction, transactions
horse-messaging
Open Source Messaging Framework. Queues, Channels, Events, Transactions, Distributed Cache
Stars: ✭ 65 (-98.94%)
Mutual labels:  distributed, transactions
Raincat
强一致分布式事务框架
Stars: ✭ 1,785 (-70.79%)
Mutual labels:  transaction, tcc
Bytetcc Sample
Stars: ✭ 119 (-98.05%)
Mutual labels:  transaction, tcc
ddal
DDAL(Distributed Data Access Layer) is a simple solution to access database shard.
Stars: ✭ 33 (-99.46%)
Mutual labels:  transaction, distributed
grabbit
A lightweight transactional message bus on top of RabbitMQ
Stars: ✭ 87 (-98.58%)
Mutual labels:  saga, outbox
Tupl
The Unnamed Persistence Library
Stars: ✭ 83 (-98.64%)
Mutual labels:  transaction, transactions
Titanoboa
Titanoboa makes complex workflows easy. It is a low-code workflow orchestration platform for JVM - distributed, highly scalable and fault tolerant.
Stars: ✭ 787 (-87.12%)
Mutual labels:  workflow-engine, distributed
ethereum-tx
Ethereum transaction library in PHP.
Stars: ✭ 144 (-97.64%)
Mutual labels:  transaction, transactions
Bytetcc
ByteTCC is a distributed transaction manager based on the TCC(Try/Confirm/Cancel) mechanism. It’s compatible with the JTA specification. User guide: https://github.com/liuyangming/ByteTCC/wiki
Stars: ✭ 2,749 (-55.01%)
Mutual labels:  transaction, tcc
Apriori-and-Eclat-Frequent-Itemset-Mining
Implementation of the Apriori and Eclat algorithms, two of the best-known basic algorithms for mining frequent item sets in a set of transactions, implementation in Python.
Stars: ✭ 36 (-99.41%)
Mutual labels:  transaction, transactions

license Build Status codecov Go Report Card Go Reference Mentioned in Awesome Go

English | 简体中文

Distributed Transactions Manager

What is DTM

DTM is a distributed transaction framework which provides cross-service eventual data consistency. It provides saga, tcc, xa, 2-phase message, outbox patterns for a variety of application scenarios. It also supports multiple languages and multiple store engine to form up a transaction as following:

function-picture

Who's using DTM (partial)

Tencent

Bytedance

Ivydad

More

Cook Book

Quick start

run dtm

git clone https://github.com/dtm-labs/dtm && cd dtm
go run main.go

Start an example

Suppose we want to perform an inter-bank transfer. The operations of transfer out (TransOut) and transfer in (TransIn) are coded in separate micro-services.

Here is an example to illustrate a solution of dtm to this problem:

git clone https://github.com/dtm-labs/dtmcli-go-sample && cd dtmcli-go-sample
go run main.go

Code

Use

  // business micro-service address
  const qsBusi = "http://localhost:8081/api/busi_saga"
  // The address where DtmServer serves DTM, which is a url
  DtmServer := "http://localhost:36789/api/dtmsvr"
  req := &gin.H{"amount": 30} // micro-service payload
	// DtmServer is the address of DTM micro-service
	saga := dtmcli.NewSaga(DtmServer, shortuuid.New()).
		// add a TransOut subtraction,forward operation with url: qsBusi+"/TransOut", reverse compensation operation with url: qsBusi+"/TransOutCom"
		Add(qsBusi+"/TransOut", qsBusi+"/TransOutCom", req).
		// add a TransIn subtraction, forward operation with url: qsBusi+"/TransIn", reverse compensation operation with url: qsBusi+"/TransInCom"
		Add(qsBusi+"/TransIn", qsBusi+"/TransInCom", req)
	// submit the created saga transaction,dtm ensures all subtractions either complete or get revoked
	err := saga.Submit()

When the above code runs, we can see in the console that services TransOut, TransIn has been called.

Timing diagram

A timing diagram for a successfully completed SAGA transaction would be as follows:

saga-success

Rollback upon failure

If any forward operation fails, DTM invokes the corresponding compensating operation of each sub-transaction to roll back, after which the transaction is successfully rolled back.

Let's purposely fail the forward operation of the second sub-transaction and watch what happens

app.POST(qsBusiAPI+"/TransIn", func(c *gin.Context) {
  log.Printf("TransIn")
  // c.JSON(200, "")
  c.JSON(409, "") // Status 409 for Failure. Won't be retried
})

The timing diagram for the intended failure is as follows:

saga-failed

More examples

The above example mainly demonstrates the flow of a distributed transaction. More on this, including practical examples of how to interface with an actual database, how to do compensation, how to do rollback, etc. please refer to dtm-examples for more examples.

Chat Group

Join the chat via https://discord.gg/dV9jS5Rb33.

Give a star!

If you think this project is interesting, or helpful to you, please give a star!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].