dtm-labs / client-csharp Goto Github PK
View Code? Open in Web Editor NEWThe new client for dtm in csharp, including workflow, dtmcli, and dtmgrpc
License: MIT License
The new client for dtm in csharp, including workflow, dtmcli, and dtmgrpc
License: MIT License
await globalTransaction.Excecute(async (tcc) =>
{
for (int i = 0; i < 20; i++)
{
var res1 = await tcc.CallBranch(request, svc + "/TransOut/Try"+i, svc + "/TransOut/Confirm" + i, svc + "/TransOut/Cancel" + i, cts.Token);
}
}, cts.Token);
之前dtmcli-csharp的使用者很容易出现的一个误会是,CallBranch调用分支时,如果分支返回了错误的结果,调用方很容易忽略,而继续执行下一步。
因此更好的做法是,检查返回的结果,如果是错误,则走异常,避免被调用者忽略。
调用分支返回错误:旧版本(dtm版本小于1.10.0)为StatusCode==200 && content.Contains("FAILRUE"),新版本可以采用StatusCode >= 400
为了兼容,SDK可以检查两种情况,然后转成异常
我在demo/src中都没有发现关于 XA模式的事务支持, 请问是我看漏了,还是c#的SDK里暂未支持XA模式?
go等客户端都支持 XA事务模式 | DTM开源项目文档 ,咱.net也不能落后了。
Support: MySql、TDSQL MySQL版 分布式事务-开发指南-文档中心-腾讯云(分布式的TDSql的XA 分布式事务与mysql有区别)
Integrate EF Core with branch barrier.
PS: I will implement it after I complete dapr support.
Keep the principle of minimum injection. Not all scenarios will involve the server-side request and sub transaction barrier. Consider leaving these two parts during dependency injection and injecting them on demand.
保持最小化注入原则,并不是所有的场景都会涉及到服务端请求和子事务屏障,考虑将这两部分在依赖注入时分离开,按需注入。
目前是直接new一个出来,应该用IHttpClientFactory
来创建
目前 cli 向 dtm服务端 和 分支事务 发起的请求都是 HttpClient 的默认超时时间。
对这两类请求,可以设置对应的自定义的超时时间。
现在配置 Dtmcli,只支持 Action 的方式,需要增加一个 IConfiguration 的方式
The new dtm client support RollbackReason and Protocol in trans_base
. We should add support in client-csharp as well.
最新版本的 dtm 客户端 在 trans_base
中 支持了 RollbackReason and Protocol, 同样也需要在 client-csharp 中支持。
After dtm v1.15.1, it support a new pattern named workflow, we should add support for this pattern.
see https://en.dtm.pub/practice/workflow.html
在 dtm v1.15.1 版本之后,支持了一种新模式 workflow,同样应该支持这种模式。
DtmCommon.DtmException: http response status: NotFound, Message :
at DtmAPI1.Controllers.TestController.PostTest() in D:\案例代码\elk\Solution1\DtmAPI1\Controllers\TestController.cs:line 46
at lambda_method5(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Support DAPR service invocation REST API with dapr driver ultiliy.
PS: I am working on it with my forked branch
Sometimes we may register services more than one time by mistake, Using TryAdd
would help to ensure service is registered once even
this method is called multi times
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.