When my business evolves and it turns out that I don't have enough information stored in my previous events, what is the appropriate way I should use at this time?
For example, let's say I'm in the business of making an order. The company's finance people ask me to give them the people and amounts in the paid orders. But my order payment event only has the amount, not the person. Do I need to add the person's information to this event and update the previous events in bulk at this time? Or do I just need to check the readstore db and that's it.
I understand the latter is simpler, but I think it's a bit of a circular dependency.
original_stream_versionfor every entry in stream_events? From my understanding every event can (and because of the $all stream there are at least two) be part of multiple streams. Why do we need to know the original_stream and original_stream_version? I ask this to have a better understanding as I have to migrate events from one aggregate to a new one due to an initial design mistake.
@gugl_twitter EventStore allows an event to be linked to multiple streams. The
original_stream_version are used to indicate the position of the event in its source stream. Each event is linked to its original stream and the global
$all stream. You could also link the event to any other stream that you choose by using the
When reading events in the global
$all stream you can use the
original_* fields to know what was the source stream and version of the event as well as position of the event in the linked stream.
EventStore.stream_all_forward/2the events are returned in the order they were appended to the global
$allstream but the stream uuid and stream version fields are populated using the values from the original stream (e.g. originating aggregate’s stream).
$allstream. For example you could build a stream per aggregate type by using a subscription to all events and then linking the received events into an appropriate stream based on the aggregate type. This then allows further subscribers to the "events by type” stream (e.g.
Have you looked at Greg Young’s book on versioning event sourced systems.
Thanks. I've been trying to set up Phoenix.PubSub.Redis as the adapter. but no luck so far.
It works locally but on heroku its throwing this error everytime:
Mon Apr 26 2021 16:19:54 unable to establish initial redis connection. Attempting to reconnect... metadata
Mon Apr 26 2021 16:19:57 failed to publish broadcast due to closed redis connection metadata
Its coming from this process:
pubsub: [ phoenix_pubsub: [ url: System.fetch_env!("REDIS_URL"), node_name: System.get_env("HEROKU_DYNO_ID", "default"), pool_size: String.to_integer(System.get_env("REDIS_POOL_SIZE", "10")) ] ]
Thanks in advance :smile:
defmodule MyApp.App do use Commanded.Application, otp_app: :my_app, event_store: [ adapter: Commanded.EventStore.Adapters.EventStore, event_store: MyApp.EventStore ] router(MyApp.ContextA.Router) router(MyApp.ContextB.Router) router(MyApp.ContextC.Router) # … etc end