thenativeweb / node-cqrs-domain

Node-cqrs-domain is a node.js module based on nodeEventStore that. It can be very useful as domain component if you work with (d)ddd, cqrs, eventdenormalizer, host, etc.
http://cqrs.js.org/pages/domain.html
MIT License
269 stars 57 forks source link

defineEventStreamsToLoad throws exception when eventstream does not exist #107

Closed edro closed 6 years ago

edro commented 6 years ago

defineEventStreamsToLoad throws exception "No event stream found for evt with id:..." when eventstream with requested aggregateId does not not exist in eventstore before. Expectation - creating new eventstream with this aggregateId

adrai commented 6 years ago

Are you making a bigger redesign in your domain and you need to handle a command on a new aggregate? i.e. merging 2 event streams into a new aggragate?

edro commented 6 years ago

I'd like to convert an input command payload using of an external service to a new aggregateId. For example: domain command contains phone number (car plate, tag etc.) in in an arbitrary manner, but i need to build (or get) aggrgate using that number as aggregate identity.

adrai commented 6 years ago

Isn't defineCommandAwareAggregateIdGenerator suitable for your use case?

edro commented 6 years ago

Thank You. Partially yes. But in this case I will have to check every command name and change id generator behavior on specific command data. I think this must be closer to specific command definition.

adrai commented 6 years ago

there's always the possibility to define an own command handler => https://github.com/adrai/node-cqrs-domain#command-handler-be-careful