Class: Sequent::Util::DryRun::RecordingEventPublisher
- Inherits:
-
Core::EventPublisher
- Object
- Core::EventPublisher
- Sequent::Util::DryRun::RecordingEventPublisher
- Defined in:
- lib/sequent/util/dry_run.rb
Overview
Records which Projector’s and Workflow’s are executed
Instance Attribute Summary collapse
-
#projectors ⇒ Object
readonly
Returns the value of attribute projectors.
-
#workflows ⇒ Object
readonly
Returns the value of attribute workflows.
Instance Method Summary collapse
-
#initialize(result) ⇒ RecordingEventPublisher
constructor
A new instance of RecordingEventPublisher.
- #process_event(event) ⇒ Object
Methods inherited from Core::EventPublisher
Constructor Details
#initialize(result) ⇒ RecordingEventPublisher
Returns a new instance of RecordingEventPublisher.
63 64 65 66 |
# File 'lib/sequent/util/dry_run.rb', line 63 def initialize(result) super() @result = result end |
Instance Attribute Details
#projectors ⇒ Object (readonly)
Returns the value of attribute projectors.
61 62 63 |
# File 'lib/sequent/util/dry_run.rb', line 61 def projectors @projectors end |
#workflows ⇒ Object (readonly)
Returns the value of attribute workflows.
61 62 63 |
# File 'lib/sequent/util/dry_run.rb', line 61 def workflows @workflows end |
Instance Method Details
#process_event(event) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/sequent/util/dry_run.rb', line 68 def process_event(event) [*Sequent::Core::Workflow.descendants, *Sequent::Core::Projector.descendants].each do |handler_class| next unless handler_class.(event) if handler_class < Sequent::Workflow @result.invoked_workflow(EventInvokedHandler.new(event, handler_class)) elsif handler_class < Sequent::Projector @result.invoked_projector(EventInvokedHandler.new(event, handler_class)) else fail "Unrecognized event_handler #{handler_class} called for event #{event.class}" end rescue StandardError raise PublishEventError.new(handler_class, event) end end |