-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Is it possible to access the created_at date of an event in apply()? #4
Comments
That's a good question I haven't considered before. Currently there's no way to access event metadata in apply. One solution would be to store a timestamp in the event itself. I'm actually in the process of rewriting thalo entirely, and have been working on it for a few weeks now. I'll try to push what I have soon to a different branch. For this reason though, I have to warn you that using Thalo currently wouldn't provide a lot since its missing a few things. You're better off waiting for me to push the rewrite, or look into another library for the time being. But if you are just playing around then it should be fine. Does Laravel event sourcing support reading event metadata when applying events to an aggregate? |
Thanks for the response! The PHP library I mentioned in my post does allow that. The events inherit from a specific class ShouldBeStored, which has the metadata assigned when they are recorded, before being handed to the aggregate apply method and then projectors and reactors. I don't mind storing dates and so-on inside the events themselves, it's just quite useful for created_at/updated_at fields on projections. I'll wait for the rewrite. This seems like a really cool project. 👍 |
Hey @PJKerrigan I've pushed the rewrite under the runtime-rewrite branch! Let me know if you have any questions if you decide to try it out, I'd love to help you with it. Or if you've joined the Discord, feel free to send a message there. |
Closing for now as the rewrite allows for this information and has been merged to main |
Forgive me if the answer to this question is obvious, I'm a beginner when it comes to Rust.
I'm looking at moving an event-sourced system using Laravel (via spatie/laravel-event-sourcing) to Rust, but there are differences between the libraries.
Is it possible to access the event metadata, particularly the date the event was created, inside of the aggregate's apply function?
The text was updated successfully, but these errors were encountered: