Skip to content

Latest commit

 

History

History
43 lines (38 loc) · 1.45 KB

Dtm.md

File metadata and controls

43 lines (38 loc) · 1.45 KB

Use DTM Server As TM Provider

DTM Server is a mature transaction manager you can use as the TM provider for Stepping. DTM allows you to get many other distributed transaction modes like SAGA, TCC, and XA.

Install DTM Server

See DTM's official document to learn how to install the DTM Server.

Install Client in Your Project

  1. Install the NuGet package:
    Install-Package Grpc.AspNetCore
    Install-Package Stepping.TmProviders.Dtm.Grpc
  2. Configure services:
    services.AddGrpc();
    services.AddSteppingDtmGrpc(options =>
    {
        options.ActionApiToken = "KLyqz0VS3mOc6VY1"; // DTM Server invokes app's action APIs with this token for authorization.
        options.AppGrpcUrl = "http://localhost:5000"; // Base URL for DTM Server to invoke the current app. Only HTTP scheme now!
        options.DtmGrpcUrl = "http://localhost:36790"; // Base URL for the current app to invoke DTM Server.
    });
  3. Configure gRPC services:
    app.MapGrpcService<SteppingService>();
  4. If you use HTTP (not HTTPS), please enable HTTP 2 for gRPC. For example, configure the appsettings.json if you use kestrel:
    "Kestrel": {
        "Endpoints": {
            "Grpc": {
                "Url": "http://localhost:5000",
                "Protocols": "Http2"
            },
            "Http": {
                "Url": "http://localhost:5001"
            }
        }
    }