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.
61 62 63 |
# File 'lib/sequent/util/dry_run.rb', line 61 def initialize(result) @result = result end |
Instance Attribute Details
#projectors ⇒ Object (readonly)
Returns the value of attribute projectors.
59 60 61 |
# File 'lib/sequent/util/dry_run.rb', line 59 def projectors @projectors end |
#workflows ⇒ Object (readonly)
Returns the value of attribute workflows.
59 60 61 |
# File 'lib/sequent/util/dry_run.rb', line 59 def workflows @workflows end |
Instance Method Details
#process_event(event) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/sequent/util/dry_run.rb', line 65 def process_event(event) Sequent.configuration.event_handlers.each do |handler| next unless handler.class.(event) if handler.is_a?(Sequent::Workflow) @result.invoked_workflow(EventInvokedHandler.new(event, handler.class)) elsif handler.is_a?(Sequent::Projector) @result.invoked_projector(EventInvokedHandler.new(event, handler.class)) else fail "Unrecognized event_handler #{handler.class} called for event #{event.class}" end rescue raise PublishEventError.new(handler.class, event) end end |