One way to handle this situation, if you need to operate on the “current state” of the entity E, is to treat commands as events as well.

You’ll need to emit an event “command C1/C2 happened”, and then wait until the command gets processed. Only the processor, which folds the events onto the state store knows if the command can get processed or not. This can lead to another event, e.g. “C1 processed successfuly”

Software engineer, Functional Programming and Scala enthusiast, SoftwareMill co-founder

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store