Skip to content

Projection event handlers #2

Description

@jesjos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions