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

Projection event handlers #2

Open
jesjos opened this issue Mar 4, 2015 · 0 comments
Open

Projection event handlers #2

jesjos opened this issue Mar 4, 2015 · 0 comments

Comments

@jesjos
Copy link
Member

jesjos commented Mar 4, 2015

Projection event handlers can choose which events to listen to, but no which events to not listen to. This may be too limiting. Perhaps we should rewrite the event handler DSL to allow such actions.

Event handlers use event filters from sandthorn_event_filter to choose which events to consume. Maybe we should just make that more explicit and do something like this:

class MySuperProjection < SandthornSequelProjection::Projection
  define_handlers do |handlers, filter|
    handlers.define my_method:
      filter.extract(events: [:new, :foo], types: [MyAggregate, OtherAggregate])
            .remove(events: [:bar, :baz], types: [FooAggregate])
  end
  def my_method(event)
    # handle event
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant