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
merged 3 commits into from Sep 20, 2018

Conversation

@slashdotdash
Copy link
Member

@slashdotdash slashdotdash commented Sep 20, 2018

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
    :ok
  end
end

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 Sep 20, 2018
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 Sep 20, 2018
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
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@slashdotdash slashdotdash deleted the feature/event-handler-subscribe-to-stream branch Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant