Class: Cadence::Workflow::History::Event
- Inherits:
-
Object
- Object
- Cadence::Workflow::History::Event
- Defined in:
- lib/cadence/workflow/history/event.rb
Constant Summary collapse
- EVENT_TYPES =
%w[ ActivityTaskStarted ActivityTaskCompleted ActivityTaskFailed ActivityTaskTimedOut ActivityTaskCanceled TimerFired RequestCancelExternalWorkflowExecutionFailed WorkflowExecutionSignaled WorkflowExecutionTerminated SignalExternalWorkflowExecutionFailed ExternalWorkflowExecutionCancelRequested ExternalWorkflowExecutionSignaled UpsertWorkflowSearchAttributes ].freeze
- CHILD_WORKFLOW_EVENTS =
%w[ StartChildWorkflowExecutionFailed ChildWorkflowExecutionStarted ChildWorkflowExecutionCompleted ChildWorkflowExecutionFailed ChildWorkflowExecutionCanceled ChildWorkflowExecutionTimedOut ChildWorkflowExecutionTerminated ].freeze
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#decision_id ⇒ Object
Returns the ID of the first event associated with the current event, referred to as a “decision” event.
-
#initialize(raw_event) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(raw_event) ⇒ Event
Returns a new instance of Event.
35 36 37 38 39 40 41 42 |
# File 'lib/cadence/workflow/history/event.rb', line 35 def initialize(raw_event) @id = raw_event.eventId @timestamp = Utils.time_from_nanos(raw_event.) @type = CadenceThrift::EventType::VALUE_MAP[raw_event.eventType] @attributes = extract_attributes(raw_event) freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
33 34 35 |
# File 'lib/cadence/workflow/history/event.rb', line 33 def attributes @attributes end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
33 34 35 |
# File 'lib/cadence/workflow/history/event.rb', line 33 def id @id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
33 34 35 |
# File 'lib/cadence/workflow/history/event.rb', line 33 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
33 34 35 |
# File 'lib/cadence/workflow/history/event.rb', line 33 def type @type end |
Instance Method Details
#decision_id ⇒ Object
Returns the ID of the first event associated with the current event, referred to as a “decision” event. Not related to DecisionTask.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cadence/workflow/history/event.rb', line 46 def decision_id case type when 'TimerFired' attributes.startedEventId when 'WorkflowExecutionSignaled' 1 # fixed id for everything related to current workflow when *EVENT_TYPES attributes.scheduledEventId when *CHILD_WORKFLOW_EVENTS attributes.initiatedEventId else id end end |