Handle missing events cases through new methodwith_aggregate!
#1351
Replies: 4 comments 1 reply
-
Just to make sure I understand:
Is this correct? I haven't yet personally found the need to implement such behaviour. This influence comes from the perspective of CQRS and using:
I think it could be useful when you're not segregating reads from writes and need such aggregate instance with internal state exposed for display. Can you please tell me more about your use case or perhaps show some code samples? |
Beta Was this translation helpful? Give feedback.
-
@pawelpacana thank you for your input. I understand the separation between the read and write models, what is not clear to me is how to handle a missing aggregate without the need to check internal details like Consider the following snippet
I need to make sure that
My main concern is the implementation of Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
@pawelpacana Alright buddy thank you for your feedback, much appreciated. |
Beta Was this translation helpful? Give feedback.
-
@pawelpacana Rethinking this. This won't work for deleted entities (soft deletes) So I ended up doing the following:
In general, I think we still need a convenient supported method to know if an aggregate is persisted or not and not rely on the callers to implement it. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Thank you for your work on rails event store. I have a quick question regarding the
#with_aggregate
method on https://github.com/RailsEventStore/rails_event_store/blob/master/aggregate_root/lib/aggregate_root/repository.rb#L22It's not clear on the callers how they should require the aggregate to already exist on the stream. Something similar to
.find
method in active record. Would it make sense to extend the repo above and include equivelant!
methods to take into account that there should be at least one event on the stream otherwise error out. It is not clear in general from the docs how to handle missing events.Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions