如何实现两阶段提交在.NET REST WCF服务? [英] How to implement two-phase commit in a .Net REST WCF service?

查看:139
本文介绍了如何实现两阶段提交在.NET REST WCF服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建RESTful Web服务,我想允许它参与分布式事务。

I'm building RESTful web service, and I want to allow it to participate in distributed transactions.

这是示例场景将是我的REST服务可能保存在服务器上文件的地方,并在同一时间调用者标记为保存在它的数据库文件。但是,如果有一个文件服务器已满,或者如果他的数据库调用失败,其他的动作不应该犯。

An example scenario would be that my REST service might save a file on a server somewhere, and at the same time the caller marks this file as saved in its database. However, if either the file server is full, or if his database call fails, the other action should not commit.

我能做些什么来保持我的身边讨价还价的?我想找到一个解决方案,适用于.NET和Java客户端。我知道这是一个棘手的问题,我想知道如果任何人有任何提示或见解?谢谢

What can I do to keep up my side of the bargain? I'd like to find a solution that works for both .Net and Java clients. I know it's a knotty problem, I was wondering if anyone had any tips or insights? Thank you

推荐答案

如果我理解正确,你说的是有多个请求不同的REST端点参与分布式事务。

If I understand you correctly, you are talking about having multiple requests to different REST endpoints participate in a distributed transaction.

在这种情况下,你应该看看此相关的问题,其中<一个href="http://stackoverflow.com/questions/1389881/transaction-in-rest-wcf-service/1390393#1390393">the回答基本上说的分布式事务是一个场景,在概念上违背了REST的原则

In that case you should take a look at this related question, where the answer basically says that distributed transactions is a scenario that conceptually goes against the principles of REST.

不过,您可以通过使用 href="http://stackoverflow.com/questions/147207/transactions-in-rest/147299#147299">解决方法说明。
你也可以看看复古,这是实现绕ACID事务中的每个元素视为一个资源的理念为中心的REST风格的交易试探性的方法。

However, you could implement a solution by using the workaround explained in this answer.
You can also take a look at RETRO, which is a tentative approach to implement RESTful transactions centered around the idea of treating every element of an ACID transaction as a resource.

相关资源:

  • RETRO: A (hopefully) RESTful Transaction Model
  • Transactions are bad for REST

这篇关于如何实现两阶段提交在.NET REST WCF服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆