Getting save errors with various class construtions
See original GitHub issueI’m still trying to tackle an example app and making progress in some directions but still failing to understand the fundamentals in this library so please know that I’m super appreciative of your patience. Once I figure this out I hope to make the example library very clear and runnable.
I’m trying to understand how best to construct classes using either the WithReflexiveMutator
or TimestampedVersionedEntity
. I’ve created the same basic class user
with the two modalities and getting different errors.
I’d love to understand the errors, yes. But I’d also like to get a decent representation of both so I’m 100% open to feedback, critique, even eye-rolling and muttered swears.
Here’s what I have so far: https://github.com/dgonzo/eventsourcing-kanban. See the README for the errors I’m seeing and the links to the relevant files.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top GitHub Comments
One thought: about the UnitOfWork, I think it’s a nice way to go, to instantiate the application object for each request. But unfortunately at the moment, if there are many threads, and if each constructs its own application object, each application will receive all event from every application currently instantiated, because the pub-sub mechanism uses a module level dict, so they aren’t separated.
That means, unless we fix up the pub-sub mechanism, you will want to have only one application object per process.
There might be a better way to do it, such as scoping the subscriptions and the publication of events to be scoped either to a thread or a request (like SQLAlchemy). But at the moment, it’s perhaps best to just have one application object. So “unit of work” might not be the best name for the application… I suggest keeping the “unit of work” but have it use an application object that is constructed once in the process, after it starts but before any requests are handled (to avoid race conditions in setting up the application object).
FWIW I tried to write about this in the documentation, here: http://eventsourcing.readthedocs.io/en/v3.0.0/topics/user_guide/deployment.html#application-object
@johnbywater thank you.