-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PLATFORM-1080]: Error handling #157
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment on commented code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment on commented code
/// The store is protected by an [`Arc`] that allows it to be cloneable still having the same memory | ||
/// reference. | ||
#[derive(Clone)] | ||
pub struct PgStore<A> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the PgStore
generic over the Aggregate
?
If this was simply PgStore
and then implement EventStore<A>
we could have one singleton instance of the store that can be reused in the application. With the current version we need a specific store instance for each aggregate, which feels redundant (yes, I know the underlying PgPool
is still shared, I'm talking about the convenience and developer experience of having multiple store instances around)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But event handlers and transactional event handlers sets are unique per aggregate..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right... so as long as the store is in charge of the handlers it must be generic as well.
Bummers
Minor Qs as discussed in a huddle with @cottinisimone:
|
https://prima-assicurazioni-spa.myjetbrains.com/youtrack/issue/PLATFORM-1080
I'm not totally sure this is an improvement. WDYT?
Pros:
Cons:
AggregateManager<PgStore<AggregateA>>
) while before it was with aggregate onlyAggregateManager<AggregateA>
.TransactionalEventHandler
can return, in case you are using PgStore, a store error (sqlx or json) or a custom boxed error, not so easy to handle when returned being a genericstd::error::Error
.