Replies: 5 comments
-
Does it assume you always append one event, as in the examples? If it allows many events, does it group them by streams and executes multiple appends — one per stream? My gut feeling is — this is fine for a framework on top of RES. And then perhaps a definition of go-to stream should be close to the definition of the event. |
Beta Was this translation helpful? Give feedback.
-
I was thinking that there's no need to consider multiple events when doing
Where is it then (that I don't see a problem in reimplementing per se (we don't owe anyone particular features), but with that we're blocking ourselves from implementing smarter RES-Browser. It won't be easy to implement some, for example, versioning functionality on the browser without at least providing some commonly agreed API on it (like "What was the previous version of that event?").
That I agree, the example was just to be simple example, but |
Beta Was this translation helpful? Give feedback.
-
As an additional highlight, if you're worried about backwards compatibility, we may mark this as experimental feature for some time: https://railseventstore.org/docs/v2/maintenance_policy/#experimental-features |
Beta Was this translation helpful? Give feedback.
-
I'm fine with this as an experimental feature. I'm fine with this in the client facade or some kind of framework-like gem/component, preferably in the latter. My only concern is handling multiple events — as in the current API of append/publish. You'd either need to change existing API (likely breaking), provide a new one side-by-side to exisitng one or provide a wrapper, (which you disregarded at the very beginning). Writing multiple events to multiple streams can increase likelihood of an entire write to conflict — in one of the strictly-ordered, frequently-written streams. |
Beta Was this translation helpful? Give feedback.
-
Moving to discussions, as noted :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I know that more-than-one project are not using publishing though event store directly:
Because of requirement to always pass stream name, which seems very reasonable when you read the docs, but in practice seem very tedious, since you end up with copy-pasting stream name everywhere, so people end up with some facades over event store to relieve that, so that you can publish your events without specifying stream name each time, and instead "fetch it" from different place. This is less of a problem in greenfield, event-sourcing or very neatly bounded systems, but you pretty much have to face that issue in legacy environments.
Examples I've saw:
event_store.publish(OrderPublished.new(...))
.event_store
here is a wrapper over RES, which inside has a mapping likeOrderPublished => ->(event) { "Order$#{event.data.fetch(:order_id)}" }
Event.publish!(OrderPublished.new(...), order)
, which inside have a mapping from an object (order
) to the stream to which this event is relevant.I think the problem is common enough, that it would make sense to provide ability to set up some kind of
StreamsNameProvider
(name is WIP), which would be able to answer the questions about the streams for given event.We would preserve current behaviour by allowing to override these defaults by the
stream_name:
keyword argument, as it is now.An example implementation of such provider within a project:
This seem flexible enough to cover most of production cases, and should be relatively easy for extension. To be clear, I am willing to implement it, but I'm opening a discussion.
WDYT?
Beta Was this translation helpful? Give feedback.
All reactions