Class: Temporal::Metadata::Activity

Inherits:
Base
  • Object
show all
Defined in:
lib/temporal/metadata/activity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#workflow?, #workflow_task?

Constructor Details

#initialize(namespace:, id:, name:, task_token:, attempt:, workflow_run_id:, workflow_id:, workflow_name:, headers: {}, heartbeat_details:) ⇒ Activity

Returns a new instance of Activity.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/temporal/metadata/activity.rb', line 8

def initialize(namespace:, id:, name:, task_token:, attempt:, workflow_run_id:, workflow_id:, workflow_name:, headers: {}, heartbeat_details:)
  @namespace = namespace
  @id = id
  @name = name
  @task_token = task_token
  @attempt = attempt
  @workflow_run_id = workflow_run_id
  @workflow_id = workflow_id
  @workflow_name = workflow_name
  @headers = headers
  @heartbeat_details = heartbeat_details

  freeze
end

Instance Attribute Details

#attemptObject (readonly)

Returns the value of attribute attempt.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def attempt
  @attempt
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def headers
  @headers
end

#heartbeat_detailsObject (readonly)

Returns the value of attribute heartbeat_details.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def heartbeat_details
  @heartbeat_details
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def namespace
  @namespace
end

#task_tokenObject (readonly)

Returns the value of attribute task_token.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def task_token
  @task_token
end

#workflow_idObject (readonly)

Returns the value of attribute workflow_id.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def workflow_id
  @workflow_id
end

#workflow_nameObject (readonly)

Returns the value of attribute workflow_name.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def workflow_name
  @workflow_name
end

#workflow_run_idObject (readonly)

Returns the value of attribute workflow_run_id.



6
7
8
# File 'lib/temporal/metadata/activity.rb', line 6

def workflow_run_id
  @workflow_run_id
end

Instance Method Details

#activity?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/temporal/metadata/activity.rb', line 23

def activity?
  true
end

#to_hObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/temporal/metadata/activity.rb', line 27

def to_h
  {
    'namespace' => namespace,
    'workflow_id' => workflow_id,
    'workflow_name' => workflow_name,
    'workflow_run_id' => workflow_run_id,
    'activity_id' => id,
    'activity_name' => name,
    'attempt' => attempt
  }
end