문제

On my first foray into integration of systems have I identified the following bounded contexts:

  1. Invoicing
  2. Subscriptions
  3. Collections

Specifically for the Collections bounded context 'suspends overdue accounts' feature, we would:

  1. Get a list of overdue invoices from Invoicing
  2. Send suspension notice to user (internal e-mailer service)
  3. Send suspension requested to Subscriptions bounded context

I understand how a blocking web service could be used to integrate the bounded contexts, but I can see this would bring issues in the event the remote service is down.

I am aware of message buses, but not sure how we would integrate with a message strategy:

Would each context contain a local read-model of external bounded context (listen for events from external bounded contexts when they are adding/deleting entities, and correlating via a unique ID)?

If using messages, do we literally build up a local copy of the entity (with fields of use for the local context) from the remote context of interest? Or am I missing something else?

도움이 되었습니까?

해결책

In your scenario, you can employ an event-driven architecture and avoid storing data locally. In order to suspend overdue accounts, you can have the Invoicing BC publish an event indicating that an invoice is past due. The Collections and Subscriptions BC would subscribe to that event and invoke the required behaviors. From the perspective of the Invoicing BC, you'd have a domain event called something like InvoiceBecamePastDue and it would be published externally via message bus.

In this case, it doesn't seem like you need a local copy. There are instances however where a local copy of data is required in which case you would maintain the local copy using published events.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top