DTM - Distributed Transaction Manager (Consul-Only Edition)
This project is a customized, runnable version of dtm-labs/dtm, designed specifically for environments where Consul is the sole microservice registry and discovery provider.
All other registry and service discovery mechanisms have been completely removed—only Consul is supported for service registry and discovery (both HTTP and gRPC). This repository provides a production-ready DTM server executable ready for direct deployment.

Key Features
- Consul as the only microservice registry/discovery mechanism
All other drivers (etcd, Eureka, SpringCloud, GoZero, Dapr, Sponge, etc.) have been removed.
- Supports both HTTP and gRPC microservice registration and discovery via Consul
- Full compatibility with DTM's industry-standard distributed transaction protocols: SAGA, TCC, XA, and Message patterns.
- Directly runnable DTM server—no code changes required for standalone deployment.
Quick Start
1. Requirements
- Go 1.18+
- Consul server (standalone or cluster)
- Microservices capable of registering themselves in Consul
2. Build and Run
git clone https://github.com/jiuziai/dtm.git
cd dtm
go build -o dtm-server main.go
./dtm-server
Or via Docker (if Dockerfile is provided):
docker build -t dtm-consul .
docker run -p 36789:36789 -p 36790:36790 dtm-consul
Example MicroService Configuration
Put this in your configuration file (e.g., config.yaml):
MicroService:
Driver: 'dtm-driver-consul' # Name used when registering the dtmdriver-consul
Target: 'consul://127.0.0.1:8500/dtm?token=your-consul-token'
EndPoint: 'grpc://172.16.18.1:36790'
- Driver: Should be
'consul', to match the registration name in dtmdriver-consul.
- Target: Consul server address and DTM service name, with optional query string for Consul ACL token, etc.
- EndPoint: The external (public) endpoint of this DTM server, e.g., for gRPC.
Usage Steps
- Start the DTM server.
- Register your business microservices with Consul (for both HTTP and gRPC).
- Configure your system as above (
config.yaml).
- Use DTM's HTTP/gRPC APIs or SDK for distributed transactions as you would with upstream dtm-labs/dtm.
For details on using SAGA, TCC, XA, and Message, see the dtm-labs/dtm documentation.
Codebase Simplification
All registry drivers except Consul are removed from the codebase. Only Consul driver is loaded:
// dtmsvr/microservices
package microservices
import (
// load the microserver drivers
// _ "github.com/dtm-labs/dtmdriver-dapr"
// _ "github.com/dtm-labs/dtmdriver-ego"
// _ "github.com/dtm-labs/dtmdriver-gozero"
// _ "github.com/dtm-labs/dtmdriver-kratos"
// _ "github.com/dtm-labs/dtmdriver-polaris"
// _ "github.com/dtm-labs/dtmdriver-springcloud"
// _ "github.com/zhufuyi/dtmdriver-sponge"
_ "github.com/jiuziai/dtmdriver-consul"
)
License and Credits
This project is a customized distribution of dtm-labs/dtm and follows the MIT License.
All original credit belongs to the dtm-labs team and contributors.
This repository provides a production-ready, runnable DTM server with streamlined service registry support for Consul only.