You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/bus-core/README.md
+13
Original file line number
Diff line number
Diff line change
@@ -87,4 +87,17 @@ export class Application {
87
87
awaitthis.bus.stop()
88
88
}
89
89
}
90
+
```
91
+
92
+
## Hooks
93
+
94
+
Hooks are callback functions that are invoked each time an action occurs. These are commonly used to add in testing, logging or health probes centrally to the application.
95
+
96
+
Hooks can be added by calling `.on()` on the bus. For example, to trigger a callback each time a message is attempted to be sent, use:
97
+
98
+
```typescript
99
+
addHook (): void {
100
+
const bus =this.container.get<Bus>(BUS_SYMBOLS.Bus)
0 commit comments