Module: Temporalio::Worker::Plugin

Included in:
SimplePlugin
Defined in:
lib/temporalio/worker/plugin.rb

Overview

Plugin mixin to include for configuring workers and workflow replayers, and intercepting the running of them.

This is a low-level implementation that requires abstract methods herein to be implemented. Many implementers may prefer SimplePlugin which includes this.

WARNING: Plugins are experimental.

Defined Under Namespace

Classes: RunWorkerOptions, WithWorkflowReplayWorkerOptions

Instance Method Summary collapse

Instance Method Details

#configure_worker(options) ⇒ Options

This method is abstract.

Configure a worker.

Parameters:

  • options (Options)

    Current immutable options set.

Returns:

  • (Options)

    Options to use, possibly updated from original.

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/temporalio/worker/plugin.rb', line 52

def configure_worker(options)
  raise NotImplementedError
end

#configure_workflow_replayer(options) ⇒ WorkflowReplayer::Options

This method is abstract.

Configure a workflow replayer.

Parameters:

Returns:

Raises:

  • (NotImplementedError)


72
73
74
# File 'lib/temporalio/worker/plugin.rb', line 72

def configure_workflow_replayer(options)
  raise NotImplementedError
end

#nameString

This method is abstract.

Returns Name of the plugin.

Returns:

  • (String)

    Name of the plugin.

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/temporalio/worker/plugin.rb', line 43

def name
  raise NotImplementedError
end

#run_worker(options, next_call) ⇒ Object

This method is abstract.

Run a worker.

Parameters:

  • options (RunWorkerOptions)

    Current immutable options set.

  • next_call (Proc)

    Proc for the next plugin in the chain to call. It accepts the options and returns an arbitrary object that should also be returned from this method.

Returns:

  • (Object)

    Result of next_call.

Raises:

  • (NotImplementedError)


63
64
65
# File 'lib/temporalio/worker/plugin.rb', line 63

def run_worker(options, next_call)
  raise NotImplementedError
end

#with_workflow_replay_worker(options, next_call) ⇒ Object

This method is abstract.

Run a replay worker.

Parameters:

  • options (WithWorkflowReplayWorkerOptions)

    Current immutable options set.

  • next_call (Proc)

    Proc for the next plugin in the chain to call. It accepts the options and returns an arbitrary object that should also be returned from this method.

Returns:

  • (Object)

    Result of next_call.

Raises:

  • (NotImplementedError)


83
84
85
# File 'lib/temporalio/worker/plugin.rb', line 83

def with_workflow_replay_worker(options, next_call)
  raise NotImplementedError
end