Module: Sequent::Core::Helpers::MessageHandler
- Included in:
- AggregateRoot, BaseCommandHandler, Projector, Workflow
- Defined in:
- lib/sequent/core/helpers/message_handler.rb
Overview
Creates ability to use DSL like:
class MyProjector < Sequent::Projector
on MyEvent do |event|
@foo = event.foo
end
end
If you extend from Sequent::AggregateRoot
, Sequent::Projector
, Sequent::Workflow
or Sequent::CommandHandler
you will get this functionality for free.
It is possible to register multiple handler blocks in the same MessageHandler
class MyProjector < Sequent::Projector
on MyEvent do |event|
@foo = event.foo
end
on MyEvent, OtherEvent do |event|
@bar = event.
end
end
The order of which handler block is executed first is not guaranteed.
Defined Under Namespace
Modules: ClassMethods Classes: OnArgumentsValidator
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(host_class) ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/sequent/core/helpers/message_handler.rb', line 100 def self.included(host_class) host_class.extend(ClassMethods) host_class.extend(MessageMatchers) host_class.extend(AttrMatchers) host_class.class_attribute :option_registry, default: MessageHandlerOptionRegistry.new end |
Instance Method Details
#handle_message(message) ⇒ Object
108 109 110 |
# File 'lib/sequent/core/helpers/message_handler.rb', line 108 def () .() end |