Class: Dynflow::Director::EventWorkItem

Inherits:
StepWorkItem show all
Defined in:
lib/dynflow/director.rb

Constant Summary

Constants inherited from Serializable

Serializable::LEGACY_TIME_FORMAT, Serializable::TIME_FORMAT

Instance Attribute Summary collapse

Attributes inherited from StepWorkItem

#step

Attributes inherited from WorkItem

#execution_plan_id, #queue, #sender_orchestrator_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WorkItem

#world, #world=

Methods inherited from Serializable

constantize, from_hash

Constructor Details

#initialize(request_id, execution_plan_id, step, event, queue, sender_orchestrator_id) ⇒ EventWorkItem

Returns a new instance of EventWorkItem.



88
89
90
91
92
# File 'lib/dynflow/director.rb', line 88

def initialize(request_id, execution_plan_id, step, event, queue, sender_orchestrator_id)
  super(execution_plan_id, step, queue, sender_orchestrator_id)
  @event = event
  @request_id = request_id
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



86
87
88
# File 'lib/dynflow/director.rb', line 86

def event
  @event
end

#request_idObject (readonly)

Returns the value of attribute request_id.



86
87
88
# File 'lib/dynflow/director.rb', line 86

def request_id
  @request_id
end

Class Method Details

.new_from_hash(hash, *_args) ⇒ Object



102
103
104
105
106
107
108
109
# File 'lib/dynflow/director.rb', line 102

def self.new_from_hash(hash, *_args)
  self.new(hash[:request_id],
    hash[:execution_plan_id],
    Serializable.from_hash(hash[:step], hash[:execution_plan_id], Dynflow.process_world),
    Dynflow.serializer.load(hash[:event]),
    hash[:queue],
    hash[:sender_orchestrator_id])
end

Instance Method Details

#executeObject



94
95
96
# File 'lib/dynflow/director.rb', line 94

def execute
  @step.execute(@event)
end

#to_hashObject



98
99
100
# File 'lib/dynflow/director.rb', line 98

def to_hash
  super.merge(request_id: @request_id, event: Dynflow.serializer.dump(@event))
end