Skip to content
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

Allow event handlers to subscribe to individual streams #203

merged 3 commits into from Sep 20, 2018


Copy link

Event handlers subscribe to all events appended to any stream by default. For event handlers that are only interested in events appended to one stream it is now possible to subcribe to a single stream using the subscribe_to option:

defmodule ExampleHandler do
  use Commanded.Event.Handler, 
    name: __MODULE__,
    subscribe_to: "stream1234"

  def handle(%AnEvent{..}, metadata) do

In the above example, the configuration would guarantee only events appended to stream stream1234 would be received and handled by the event handler.

Closes #174.

… stream

Including subscriptions to all events appended to any stream by using `:all` during subscribe.
@slashdotdash slashdotdash force-pushed the feature/event-handler-subscribe-to-stream branch 4 times, most recently from 38df233 to c876925 Compare September 20, 2018 21:09
Event handler can specify `subscribe_to` as a config option to determine a single stream to subscribe to.

By default the handler will subscribe to all events appended to any stream.
@slashdotdash slashdotdash force-pushed the feature/event-handler-subscribe-to-stream branch from c876925 to ff1f561 Compare September 20, 2018 21:14
To allow reuse by external registry providers who want to implement the `Commanded.Registration` behaviour.
@slashdotdash slashdotdash merged commit ff2788a into master Sep 20, 2018
@slashdotdash slashdotdash deleted the feature/event-handler-subscribe-to-stream branch September 20, 2018 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant