First time poster here, thanks for collating such a great resource.
I’m investigating using Axon Framework where we need to create a kind of parallel model to allow for separate ‘workspaces’. In a workspace, a user can draft a series of changes that may cross various aggregates.
At a high level, we could support this by tagging any events produced in a draft workspace with the workspace name. This could be done by adding a column to the domain event entry table or using metadata somehow. The write model for a draft workspace is then the collection of events in the main workspace (before creating the draft) plus any events in that workspace since.
Read models pose another problem. Some may be able to handle two versions of the universe while some may need to be rebuilt for each workspace. Applying changes from a workspace back into the main workspace would be a matter of replaying the commands (which might fail where there are conflicts).
I’ve done a spike using a custom
EventStorageEngine which grabs the current workspace name out of a thread local, and persists it along with event in a separate column. I updated all read queries by adding an extra condition to the WHERE clauses. Seems to work so far, but I’m wondering if there is a better way to implement this functionality (for example I’m unsure of the implications this would have on any
Has anyone done something similar and can tell me how terrible my approach is?