Does every Rails Event Store event that's been published automatically get assigned a timestamp
? I'm trying to build functionality that relies upon a timestamp automatically being present for events deserialize
d from the event_store
within a job, but I don't know that I can rely on that. I'm hoping that one does not need to manually add a timestamp
to the event's metadata
in order for a timestamp
to be present, since it doesn't appear that that's been done anywhere in the code base I'm working on. I'm aware that the docs indicate that the return value of the RubyEventStore::Event#timestamp
method can be nil
, but I'm hoping that it won't be nil
for published events.
Unless you provide your own timestamp (the :timestamp
key in metadata) each stored event will have metadata enriched with current time - see https://github.com/RailsEventStore/rails_event_store/blob/master/ruby_event_store/lib/ruby_event_store/client.rb#L311
It can be nil
. But only if your clock
provided to RailsEventStore client will return nil.
In upcoming Rails Event Store 2.0 release we will also add the validity time (valid_at
attribute in metadata) that will allow to implement BI Temporal event sourcing. Stay tuned.