class Temporal::Activity::Context
Attributes
client[R]
metadata[R]
Public Class Methods
new(client, metadata)
click to toggle source
# File lib/temporal/activity/context.rb, line 10 def initialize(client, metadata) @client = client @metadata = metadata @async = false end
Public Instance Methods
async()
click to toggle source
# File lib/temporal/activity/context.rb, line 16 def async @async = true end
async?()
click to toggle source
# File lib/temporal/activity/context.rb, line 20 def async? @async end
async_token()
click to toggle source
# File lib/temporal/activity/context.rb, line 24 def async_token AsyncToken.encode( metadata.namespace, metadata.id, metadata.workflow_id, metadata.workflow_run_id ) end
headers()
click to toggle source
# File lib/temporal/activity/context.rb, line 55 def headers metadata.headers end
heartbeat(details = nil)
click to toggle source
# File lib/temporal/activity/context.rb, line 33 def heartbeat(details = nil) logger.debug("Activity heartbeat", metadata.to_h) client.record_activity_task_heartbeat(task_token: task_token, details: details) end
heartbeat_details()
click to toggle source
# File lib/temporal/activity/context.rb, line 38 def heartbeat_details metadata.heartbeat_details end
logger()
click to toggle source
# File lib/temporal/activity/context.rb, line 42 def logger Temporal.logger end
run_idem()
click to toggle source
# File lib/temporal/activity/context.rb, line 46 def run_idem UUID.v5(metadata.workflow_run_id.to_s, metadata.id.to_s) end
Also aliased as: idem
workflow_idem()
click to toggle source
# File lib/temporal/activity/context.rb, line 51 def workflow_idem UUID.v5(metadata.workflow_id.to_s, metadata.id.to_s) end
Private Instance Methods
task_token()
click to toggle source
# File lib/temporal/activity/context.rb, line 63 def task_token metadata.task_token end