Support for event metadata when writing to EventStore
Opened this issue · 0 comments
Hi,
I'm using NestJS CQRS architecture with nestjs-eventstore
package for emitting event to EventStore and I'm planning to implement a middleware for pub/sub of events to handle things like logging and and setting some default event metadata.
Besides the fact that it's going to be tricky because of lack of support for any kind of events interception when publishing (this is not the subject of this issue, but any ideas are welcome too) there is one more fundamental problem: lack of support for setting event metadata when writing an event to EventStore.
The critical place in the code seems to be EventStoreBus.publish
method:
nestjs-eventstore/src/event-store/eventstore-cqrs/event-store.bus.ts
Lines 146 to 152 in 94f2092
which just doesn't support metadata (it would be a fifth argument passed to createEventData
)
I would imagine this could be solved by adding another custom field in the event object and using it in EventPublisher
, similarly to how currently streamName
is handled:
nestjs-eventstore/src/event-store/eventstore-cqrs/event-publisher.ts
Lines 23 to 29 in 94f2092
My question is:
do you have plans to implement support for writing event metadata with the event or any experiences with implementing it? Is there anything I should know that I don't see at this point and that is a blocker or a more complex issue?
Thanks!