Questions tagged [domain-events]
130 questions
4
votes
2 answers
Does application event term exist in DDD?
Domain events are well known in DDD, which can be published in Aggregate Roots or in Domain Services. My question here is, Can domain events be published in application services/use cases?
For example, simplifying. I have an application service…

Mr. Mars
- 762
- 1
- 9
- 39
4
votes
1 answer
Domain Events v Event Aggregator v... other
I have a composite structure in my domain where the leaf node (Allocation) has a DurationChanged event that I would like to use at the top of my presentation layer view model structure (in the TimeSheetViewModel), and I am wondering what the best…

Berryl
- 12,471
- 22
- 98
- 182
4
votes
2 answers
How to deal with updating Entity (CRUD) and Domain Events using DDD?
I know that DDD is good with a Task-Based UI, but I'm refactoring a legacy app, where I have Anemic Domain Model (many setters without business logic).
One of the first steps was to make it reach model and add Domain Events. While adding events for…

borN_free
- 1,385
- 11
- 19
4
votes
2 answers
Should the rule "one transaction per aggregate" be taken into consideration when modeling the domain?
Taking into consideration the domain events pattern and this post , why do people recomend keeping one aggregate per transaction model ? There are good cases when one aggregate could change the state of another one . Even by removing an aggregate…

Tudor
- 1,133
- 1
- 12
- 28
4
votes
1 answer
Domain Events pattern single point to queue events
I put a question here: Raising Domain Events For Multiple Subscribers and the answer led me to the following pattern where I can have an IEventPublisher like so:
public interface IEventPublisher
{
void Publish(T data);
}
and an…

user351711
- 3,171
- 5
- 39
- 74
3
votes
1 answer
Guarantying eventual consistency without a message broker (utilising an in memory message bus)
I am thinking if there could be an easy way to guarantee eventual consistency in an event driven modular monolith, which is utilising an in process message bus instead of an actual external message broker.
All solutions out there seem to utilise…

Antonis S
- 733
- 6
- 15
3
votes
1 answer
Can domain event be raised in domain service?
I'm wondering if domain event can be raised in domain service? I've got such a code written in C#. Of course it works, but is it correct from DDD point of view?
First example is related to user deletion. In my system Account has multiple users.…

Przemysław P.
- 81
- 1
- 5
3
votes
1 answer
Creating Command Inside a Domain Event Handler In CQRS
I have a simple scenario regarding CQRS and DDD in mind and I can't figure out the right way to implement it:
Order and Buyer are two aggregate roots inside Ordering service. When a user checks out the basket:
An integration event is raised in…

Gru97
- 471
- 5
- 8
3
votes
1 answer
Handling a domain event in an asp.net mvc controller
I'm looking into using Domain Events to bubble information from operations occuring deep inside of my domain model in order to signal certain events at the controller level. Unfortunately, I haven't been able to find an example of how to properly…

DanP
- 6,310
- 4
- 40
- 68
3
votes
1 answer
Is it possible to implement MediatR in the Aggregates (Domain Layer) without dependency injection (DDD)?
To prevent reinventing the wheel, I'd like to use MediatR in the Aggregates to publish domain events. (Un)Fortunately(?) MediatR works as a dependency that is injected into the classes, and not something that I can call statically. Therefore I'd end…

Jose A
- 10,053
- 11
- 75
- 108
3
votes
3 answers
Loading aggregates on reacting to domain events
I am implementing an application with domain driven design and event sourcing. I am storing all domain events in a DomainEvents table in SQL Server.
I have the following aggregates:
- City
+ Id
+ Enable()
+ Disable()
- Company
+ Id
+…

kaz
- 103
- 5
3
votes
3 answers
Domain-Driven Design: how to model nested product category hierarchy? Even worse, what if the product category is an Aggregate Root?
I am practicing Domain-Driven Design so why not build a demo product catalog project? Apparently Product is the Core Domain here, but since I like to make the project more interesting, I would love to support nested Category hierarchy. In other…

David Liang
- 20,385
- 6
- 44
- 70
3
votes
1 answer
Which Layer for Domain Events, EventHandlers, Dispatcher
I have been reading about Domain Events and have seen codes from Udi's implementation(http://www.udidahan.com/2009/06/14/domain-events-salvation/)
,Mike Hadlow (http://mikehadlow.blogspot.com/2010/09/separation-of-concerns-with-domain.html), Jimmy…

TheMar
- 1,934
- 2
- 30
- 51
3
votes
2 answers
Can an aggregate be part of a domain-event?
Consider an aggregate with many properties. For example UserGroup. If I want to publish a UserGroupCreatedEvent I can do 2 things:
duplicate the properties from the just created UserGroup to
UserGroupCreatedEvent and copy their values. OR:
Refer to…

Pepster
- 1,996
- 1
- 24
- 41
3
votes
3 answers
Who is responsible for entity's mutation when domain event is raised? DDD
I've been learning about CQRS/ES. Looking at small example projects I often see events mutating the entity state. For instance If we look at the Order aggregate root:
public class Order : AggregateRoot {
private void Apply(OrderLineAddedEvent…

lexeme
- 2,915
- 10
- 60
- 125