Producing Events
In Codebricks, a Command Usecase can trigger multiple events, which might affect the state of your Aggregates. Modeling these events and their impact on the Aggregate state independently is crucial for accurate event sourcing and CQRS implementation.
Adding an Event
To add a new event to a Usecase, follow these steps:
-
Open Usecase Details Menu:
- Click on a Usecase on the map to access its details.
-
Open the Usecase Management Menu:
- Click the Hamburger Menu icon (
) on the very left of the Usecase Details Menu.
This action will open an additional menu on the left side.
- Click the Hamburger Menu icon (
-
Add Event:
- Click on Add Event from the expanded menu.
-
Configure the Event:
- A new event will appear in the Usecase Details and on the Event Map.
- An additional horizontal lane will be added for each event in the Usecase Details, where you can name the event, define its schema, and connect it to the Aggregate state.
Removing an Event
To remove an event, follow these steps:
-
Open Usecase Details Menu:
- Click on a Usecase on the map to access its details.
-
Open the Usecase Management Menu:
- Click the Hamburger Menu icon (
) on the very left of the Usecase Details Menu.
This will open an extra menu on the left side.
- Click the Hamburger Menu icon (
-
Remove Event:
- Click the small x on the chip of the event you want to remove.
You can only remove events that are not currently being used in another Usecase. Removing events that are in use could cause inconsistencies or errors in your application's data flow.