juicycleff / nestjs-event-store

NestJS CQRS module for EventStore.org. It requires @nestjs/cqrs
https://xraph.com
MIT License
199 stars 29 forks source link

Cannot publish to stream with aggregate ID in stream name #1

Closed clarkstachio closed 4 years ago

clarkstachio commented 4 years ago

I am not able to publish to a stream with the related aggregate ID as part of the stream name. I would like to publish to a stream with the name "widget-223434", where 223434 is the aggregate root ID and widget is the aggregate class. This is handled by @daypaio in the nestjs-eventstore in his EventPublisher implementation.

It seems the only way to set the stream name when publishing is when importing NestjsEventStoreModule with the forFeature method and passing in config with the featureStreamName set. When specifying the stream name here it is constant for the module and there is no way to reference the aggregateID as part of the stream.

Is this use case being considered? Am I misunderstanding how to implement this?

robodude666 commented 4 years ago

@clarkstachio I believe you are correct in understanding. Or at least, we're both wrong 😄 .

It seems like you can only have a single stream for all events for a given module.

juicycleff commented 4 years ago

@robodude666 you are correct indeed, you can only have a single stream for all events in any given module. It was designed specifically to behave this way

juicycleff commented 4 years ago

@clarkstachio please could you explain better what you're trying to achieve? You can take a look at https://github.com/juicycleff/ultimate-backend to see how I'm using it there :)