2

I play around with CQRS/event sourcing for a couple of months now. Currently, I'm having trouble with another experiment I try and hope somebody could help, explain or even hint on another approach than event sourcing.

I want to build a distributed application in which every user has governance of his/her data. So my idea is each user hosts his own event store while other users may have (conditional) access to it.

When user A performs some command this may imply more than one event store. Two examples:

1) Delete a shared task from a tasklist hosted by both event store A and B

2) Adding the reference to a comment persisted in event store A to a post persisted in event store B.

My only solution currently seems to use a process manager attached to each event store, so when an event was added to one event store, a saga deals with applying the event to other related event stores as well.

Florian Bachmann
  • 532
  • 6
  • 14
  • It is not clear why each user has to host their own event store. Can you please elaborate on that a bit more? – IlliakaillI Jan 10 '17 at 03:19
  • @IlliakaillI: I have a system running where each user has a couple of lists with sensitive data. Some lists ought to be shared with other users, others not. Currently, this is my private stuff, so only a few users. But I plan to publish it and many users will be unconfident trusting this sensitive data to an unknown service. That is why I want to give the users governance onto their data and the possibility to share parts of it. – Florian Bachmann Jan 20 '17 at 09:08

1 Answers1

0

Not sure what is the purpose of your solution but if you want one system to react on events from another system, after events are saved to the store, a subscription (like catch-up subscription provided by Greg Young's EventStore) publishes it on a message bus using pub-sub and all interested parties can handle this event.

However, this will be wrong if they just "save" this event to their stores. In fact they should have an event handler that will produce a command inside the local service and this command might (or might not) result in a local event, if all conditions are met. Only something that happens within the boundaries, under the local control, should be saved to the local store.

Alexey Zimarev
  • 17,944
  • 2
  • 55
  • 83
  • Thank you, I thought of a similar architecture as this subscription in Greg Young's event store. However ... 1) My events must not be submitted to not permitted systems, i.e. only to systems that are allowed to see the data. Does something like a conditional access message bus exist? 2) Lets say system A processes a command and emits an event to system B. B would produce a command from it and try to process it. If it succeeds, good, but if not, would it make sense to emit another event to system A to signal a failure or how would I deal with it? – Florian Bachmann Jan 20 '17 at 09:16