Class: Textus::Workflow::EventEmitter
- Inherits:
-
Object
- Object
- Textus::Workflow::EventEmitter
- Defined in:
- lib/textus/workflow/event_emitter.rb
Instance Method Summary collapse
- #emit(event_type:, key:, lane: "artifacts") ⇒ Object
-
#initialize(workflow_queue, registry:) ⇒ EventEmitter
constructor
A new instance of EventEmitter.
Constructor Details
#initialize(workflow_queue, registry:) ⇒ EventEmitter
Returns a new instance of EventEmitter.
4 5 6 7 |
# File 'lib/textus/workflow/event_emitter.rb', line 4 def initialize(workflow_queue, registry:) @workflow_queue = workflow_queue @registry = registry end |
Instance Method Details
#emit(event_type:, key:, lane: "artifacts") ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/textus/workflow/event_emitter.rb', line 9 def emit(event_type:, key:, lane: "artifacts") workflows = @registry.workflows_for(event_type) workflows.each do |wf| @workflow_queue.push( event_type: event_type.to_s, workflow_type: wf.type, key:, lane:, max_attempts: wf.max_attempts ) end workflows.size end |