Class: Temporalio::Internal::Worker::ActivityWorker::RunningActivity
- Inherits:
-
Activity::Context
- Object
- Activity::Context
- Temporalio::Internal::Worker::ActivityWorker::RunningActivity
- Defined in:
- lib/temporalio/internal/worker/activity_worker.rb
Instance Attribute Summary collapse
-
#_outbound_impl ⇒ Object
Returns the value of attribute _outbound_impl.
-
#_server_requested_cancel ⇒ Object
readonly
Returns the value of attribute _server_requested_cancel.
-
#cancellation ⇒ Object
readonly
Returns the value of attribute cancellation.
-
#cancellation_details ⇒ Object
readonly
Returns the value of attribute cancellation_details.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#payload_converter ⇒ Object
readonly
Returns the value of attribute payload_converter.
-
#worker_shutdown_cancellation ⇒ Object
readonly
Returns the value of attribute worker_shutdown_cancellation.
Instance Method Summary collapse
- #_cancel(reason:, details:) ⇒ Object
- #client ⇒ Object
- #heartbeat(*details) ⇒ Object
-
#initialize(worker:, info:, cancellation:, worker_shutdown_cancellation:, payload_converter:, logger:, runtime_metric_meter:) ⇒ RunningActivity
constructor
rubocop:disable Lint/MissingSuper.
- #metric_meter ⇒ Object
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
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 354 def initialize( # rubocop:disable Lint/MissingSuper worker:, info:, cancellation:, worker_shutdown_cancellation:, payload_converter:, logger:, runtime_metric_meter: ) @worker = worker @info = info @cancellation = cancellation @cancellation_details = nil @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_impl ⇒ Object
Returns the value of attribute _outbound_impl.
352 353 354 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 352 def _outbound_impl @_outbound_impl end |
#_server_requested_cancel ⇒ Object (readonly)
Returns the value of attribute _server_requested_cancel.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def _server_requested_cancel @_server_requested_cancel end |
#cancellation ⇒ Object (readonly)
Returns the value of attribute cancellation.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def cancellation @cancellation end |
#cancellation_details ⇒ Object (readonly)
Returns the value of attribute cancellation_details.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def cancellation_details @cancellation_details end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def info @info end |
#instance ⇒ Object
Returns the value of attribute instance.
352 353 354 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 352 def instance @instance end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def logger @logger end |
#payload_converter ⇒ Object (readonly)
Returns the value of attribute payload_converter.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def payload_converter @payload_converter end |
#worker_shutdown_cancellation ⇒ Object (readonly)
Returns the value of attribute worker_shutdown_cancellation.
350 351 352 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 350 def worker_shutdown_cancellation @worker_shutdown_cancellation end |
Instance Method Details
#_cancel(reason:, details:) ⇒ Object
398 399 400 401 402 403 404 405 406 407 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 398 def _cancel(reason:, details:) # Do not issue cancel if already canceled return if @cancellation_details @_server_requested_cancel = true # Set the cancellation details _before_ issuing the cancel itself @cancellation_details = details _, cancel_proc = cancellation cancel_proc.call(reason:) end |
#client ⇒ Object
394 395 396 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 394 def client @worker.client end |
#heartbeat(*details) ⇒ Object
375 376 377 378 379 380 381 382 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 375 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_meter ⇒ Object
384 385 386 387 388 389 390 391 392 |
# File 'lib/temporalio/internal/worker/activity_worker.rb', line 384 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 |