Skip to content

Commit e90d724

Browse files
committed
docs(cqrs): add some hint about event handler usage
1 parent a5b8181 commit e90d724

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

content/recipes/cqrs.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ export class HeroKilledDragonHandler implements IEventHandler<HeroKilledDragonEv
224224

225225
Now we can move the **write logic** into the event handlers.
226226

227+
> info **Hint** Be aware that when you start using event handlers you get out of the traditional HTTP web context.
228+
> - Errors in `CommandHandlers` can still be catched by built-in [Exception filters](/exception-filters).
229+
> - Errors in `EventHandlers` won't: you will have to treat them manually. Either by a simple `try/catch`, using [Sagas](/recipes/cqrs#sagas) by triggering a compensating event, or whatever solution you choose.
230+
> - HTTP Response in `CommandHandlers` can still be sent back to the client.
231+
> - HTTP Response in `EventHandlers` cannot. If you want to get feedback for the client you could use [WebSocket](/websockets/gateways), [SSE](/techniques/server-sent-events), or whatever solution you choose.
232+
227233
#### Sagas
228234

229235
This type of **Event-Driven Architecture** improves application **reactiveness and scalability**. Now, when we have events, we can simply react to them in various ways. **Sagas** are the final building block from an architectural point of view.

0 commit comments

Comments
 (0)