开发者

When a line item is removed from an order, is it ok to have a transaction across bounded contexts?

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 th开发者_高级运维is 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.


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜