We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
How to create a transient subscription to a stream, or all streams, and wait until an expected event is received.
Use Commanded.EventStore.subscribe/2 as shown in the following example.
Commanded.EventStore.subscribe/2
alias Commanded.EventStore.RecordedEvent defp receive_events(selector) do receive do {:events, events} -> case reduce(events, selector) do :cont -> receive_events(selector) {:halt, result} -> result end end end defp reduce([], _selector), do: :cont defp reduce([%RecordedEvent{data: data} | events], selector) do case selector.(data) do :cont -> reduce(events, selector) {:halt, result} -> {:halt, result} end end
:ok = Commanded.EventStore.subscribe(MyApp.App, stream_uuid) receive_events(fn %AnEvent{} = event -> {:halt, event} _event -> :cont end)
Use :all as the stream identity to subscribe to all events.
:all
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How to create a transient subscription to a stream, or all streams, and wait until an expected event is received.
Use
Commanded.EventStore.subscribe/2
as shown in the following example.Usage
Use
:all
as the stream identity to subscribe to all events.The text was updated successfully, but these errors were encountered: