当从订单中删除订单项时,是否可以跨有界上下文进行事务?

发布于 2024-11-17 10:24:06 字数 457 浏览 7 评论 0原文

在我的领域中,我有 2 个与此问题相关的有界上下文:

  1. 采购 - 客户订购服务的地方
  2. 履行 - 服务被分配给供应商来完成的地方

要求客户在整个过程中的任何给定时间都可以编辑订单订单的生命周期。

如果客户从订单中(即在购买上下文中)删除服务,如果该服务已分配给要执行的供应商(但尚未执行),则该服务也必须在履行上下文中删除。

这里有几个选项,我想听听社区的意见:

  1. 我的上下文错误,因为这将创建跨上下文事务。
  2. 我这里可能不需要事务一致性。当然,这由业务利益相关者决定,这就引出了两个问题:实施选项是什么?我如何向业务利益相关者提出这个问题?
  3. 这是对“无跨上下文事务”规则的可接受的违反。

编辑

这一切都发生在单个进程中,因此中间事务失败的可能性非常低。

In my domain, I have 2 bounded contexts that are relevant to this question:

  1. Purchasing - where the customer orders services
  2. Fulfillment - where services are assigned to vendors to be completed

It's a requirement that an order is editable by the customer at any given time throughout the life of the order.

If a customer removes a service from an order (i.e. within the purchasing context), if that service has already been assigned to a vendor to be performed (but has not already been performed) that service must also be removed in the fulfillment context.

There's a couple of options here, and I'd like the community's opinion:

  1. I have my contexts wrong because this will create a cross-context transaction.
  2. I may not need transactional consistency here. Of course, that's for the business stakeholder to decide, which begs 2 questions: What are the implementation options? How do I pose this question to the business stakeholder?
  3. This is an acceptable violation of the "no cross-context transactions" rule.

EDIT

This is all happening within a single process, so the likelihood of mid-transaction failure is very low.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

两个我 2024-11-24 10:24:06

这是要问您的利益相关者的问题,即:订单始终可编辑 - 订单在履行后进行编辑意味着什么?

Here's the question to ask your stakeholder, re: an order being editable at all times - what does it mean for an order to be edited after it has already been fulfilled?

黑色毁心梦 2024-11-24 10:24:06

为什么编辑订单时一定会影响履行服务?

在我看来,这跨越了有界上下文。订单在编辑时不应离开其域,除非有充分的理由。为什么订单信息会在完成之前传播到履行服务?

基于我对您的领域的明显非常有限的了解,我认为您将首先完成订单,然后将创建事件发送到服务总线,由履行服务拾取该事件。因此,不会发生跨上下文的事务。

Why is it necessary that when an order is edited, this impacts the fulfillment service?

This, in my mind, crosses the bounded contexts. An order, while being edited, should not leave its domain unless there is good reason to. Why would any order information be propagated to the fulfillment service before it is complete?

Based on my obviously very limited understanding of your domain, I would think that you would complete the order first, then send a creation event to the service bus, where it is picked up by the fulfillment service. Therefore, no transactions are taking place that cross contexts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文