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.
See DTM's official document to learn how to install the DTM Server.
- Install the NuGet package:
Install-Package Grpc.AspNetCore Install-Package Stepping.TmProviders.Dtm.Grpc
- 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. });
- Configure gRPC services:
app.MapGrpcService<SteppingService>();
- 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" } } }