Class: Temporalio::Internal::Worker::ActivityWorker::RunningActivity

Inherits:
Activity::Context
  • Object
show all
Defined in:
lib/temporalio/internal/worker/activity_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Activity::Context

current, current_or_nil, exist?

Constructor Details

#initialize(worker:, info:, cancellation:, worker_shutdown_cancellation:, payload_converter:, logger:, runtime_metric_meter:) ⇒ RunningActivity

rubocop:disable Lint/MissingSuper



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 304

def initialize( # rubocop:disable Lint/MissingSuper
  worker:,
  info:,
  cancellation:,
  worker_shutdown_cancellation:,
  payload_converter:,
  logger:,
  runtime_metric_meter:
)
  @worker = worker
  @info = info
  @cancellation = cancellation
  @worker_shutdown_cancellation = worker_shutdown_cancellation
  @payload_converter = payload_converter
  @logger = logger
  @runtime_metric_meter = runtime_metric_meter
  @_outbound_impl = nil
  @_server_requested_cancel = false
end

Instance Attribute Details

#_outbound_implObject

Returns the value of attribute _outbound_impl.



302
303
304
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 302

def _outbound_impl
  @_outbound_impl
end

#_server_requested_cancelObject

Returns the value of attribute _server_requested_cancel.



302
303
304
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 302

def _server_requested_cancel
  @_server_requested_cancel
end

#cancellationObject (readonly)

Returns the value of attribute cancellation.



301
302
303
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 301

def cancellation
  @cancellation
end

#infoObject (readonly)

Returns the value of attribute info.



301
302
303
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 301

def info
  @info
end

#instanceObject

Returns the value of attribute instance.



302
303
304
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 302

def instance
  @instance
end

#loggerObject (readonly)

Returns the value of attribute logger.



301
302
303
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 301

def logger
  @logger
end

#payload_converterObject (readonly)

Returns the value of attribute payload_converter.



301
302
303
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 301

def payload_converter
  @payload_converter
end

#worker_shutdown_cancellationObject (readonly)

Returns the value of attribute worker_shutdown_cancellation.



301
302
303
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 301

def worker_shutdown_cancellation
  @worker_shutdown_cancellation
end

Instance Method Details

#clientObject



343
344
345
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 343

def client
  @worker.client
end

#heartbeat(*details) ⇒ Object



324
325
326
327
328
329
330
331
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 324

def heartbeat(*details)
  raise 'Implementation not set yet' if _outbound_impl.nil?

  # No-op if local
  return if info.local?

  _outbound_impl.heartbeat(Temporalio::Worker::Interceptor::Activity::HeartbeatInput.new(details:))
end

#metric_meterObject



333
334
335
336
337
338
339
340
341
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 333

def metric_meter
  @metric_meter ||= @runtime_metric_meter.with_additional_attributes(
    {
      namespace: info.workflow_namespace,
      task_queue: info.task_queue,
      activity_type: info.activity_type
    }
  )
end