dtm

command module
v0.0.0-...-a415251 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2025 License: BSD-3-Clause Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

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.


license Build Status Go Report Card Go Reference


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

  1. Start the DTM server.
  2. Register your business microservices with Consul (for both HTTP and gRPC).
  3. Configure your system as above (config.yaml).
  4. 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.

Documentation

Overview

package main is the entry of dtm server

Directories

Path Synopsis
client
storage/boltdb
package boltdb implement the storage for boltdb
package boltdb implement the storage for boltdb
storage/redis
package reds implement the storage for reds
package reds implement the storage for reds
storage/sql
package boltdb implement the storage for sql database
package boltdb implement the storage for sql database
helper
bench command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址