File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,29 @@ const job = new OutboxPeriodicJob(
35
35
36
36
Job will take care of processing outbox entries emitted by:
37
37
``` typescript
38
- const emitter = new OutboxEventEmitter (
38
+ import {
39
+ type CommonEventDefinition ,
40
+ enrichMessageSchemaWithBase ,
41
+ } from ' @message-queue-toolkit/schemas'
42
+
43
+ const MyEvents = {
44
+ created: {
45
+ ... enrichMessageSchemaWithBase (
46
+ ' entity.created' ,
47
+ z .object ({
48
+ message: z .string (),
49
+ }),
50
+ ),
51
+ },
52
+ } as const satisfies Record <string , CommonEventDefinition >
53
+
54
+ type MySupportedEvents = (typeof TestEvents )[keyof typeof TestEvents ][]
55
+
56
+ const emitter = new OutboxEventEmitter <MySupportedEvents >(
39
57
// Same instance of outbox storage that is used by OutboxPeriodicJob
40
58
outboxStorage
41
59
)
60
+
61
+ // It pushes the entry to the storage, later will be picked up by the OutboxPeriodicJob
62
+ await emitter .emit (/* args */ )
42
63
```
You can’t perform that action at this time.
0 commit comments