Class: Temporal::Workflow::History::Event
- Inherits:
-
Object
- Object
- Temporal::Workflow::History::Event
- Defined in:
- lib/temporal/workflow/history/event.rb
Constant Summary collapse
- EVENT_TYPES =
%w[ ACTIVITY_TASK_STARTED ACTIVITY_TASK_COMPLETED ACTIVITY_TASK_FAILED ACTIVITY_TASK_TIMED_OUT ACTIVITY_TASK_CANCELED TIMER_FIRED REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED EXTERNAL_WORKFLOW_EXECUTION_SIGNALED UPSERT_WORKFLOW_SEARCH_ATTRIBUTES ].freeze
- CHILD_WORKFLOW_EVENTS =
%w[ START_CHILD_WORKFLOW_EXECUTION_FAILED CHILD_WORKFLOW_EXECUTION_STARTED CHILD_WORKFLOW_EXECUTION_COMPLETED CHILD_WORKFLOW_EXECUTION_FAILED CHILD_WORKFLOW_EXECUTION_CANCELED CHILD_WORKFLOW_EXECUTION_TIMED_OUT CHILD_WORKFLOW_EXECUTION_TERMINATED ].freeze
- PREFIX =
'EVENT_TYPE_'.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
-
#initialize(raw_event) ⇒ Event
constructor
A new instance of Event.
-
#originating_event_id ⇒ Object
Returns the ID of the first event associated with the current event.
Constructor Details
#initialize(raw_event) ⇒ Event
Returns a new instance of Event.
33 34 35 36 37 38 39 40 |
# File 'lib/temporal/workflow/history/event.rb', line 33 def initialize(raw_event) @id = raw_event.event_id @timestamp = raw_event.event_time.to_time @type = raw_event.event_type.to_s.gsub(PREFIX, '') @attributes = extract_attributes(raw_event) freeze end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
31 32 33 |
# File 'lib/temporal/workflow/history/event.rb', line 31 def attributes @attributes end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
31 32 33 |
# File 'lib/temporal/workflow/history/event.rb', line 31 def id @id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
31 32 33 |
# File 'lib/temporal/workflow/history/event.rb', line 31 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
31 32 33 |
# File 'lib/temporal/workflow/history/event.rb', line 31 def type @type end |
Instance Method Details
#originating_event_id ⇒ Object
Returns the ID of the first event associated with the current event.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/temporal/workflow/history/event.rb', line 43 def originating_event_id case type when 'TIMER_FIRED' attributes.started_event_id when 'WORKFLOW_EXECUTION_SIGNALED', 'WORKFLOW_EXECUTION_TERMINATED' 1 # fixed id for everything related to current workflow when *EVENT_TYPES attributes.scheduled_event_id when *CHILD_WORKFLOW_EVENTS attributes.initiated_event_id else id end end |