temporalio / temporalio/features

Plugins to support controlling multiple configuration points at once

Open
#652 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
32
Forks
28
Avg merge
1d 9h
Merged PRs (30d)
7

Description

Is your feature request related to a problem? Please describe.

Users often need to configure a number of things in order to support certain systems. For instance, all workflows at Company X might need to register a dataconverter, customize the sandbox, register a set of activities, etc.

Describe the solution you'd like

A plugin model to allow configuring all these points at once.

# In client (would rather have this on client.Interceptor, but people
# are concerned with the name "interceptor" though I prefer it)
class Plugin:
  # NOTE: ClientConnectConfig could help at https://github.com/temporalio/sdk-python/pull/895
  async def connect_client(self, config: ClientConnectConfig, next: Plugin) -> Client:
    # Default impl calls next
	  
  def create_client(self, config: ClientConfig, next: Plugin) -> Client:
    # Default impl calls next
    
# In worker (would rather have this on worker.Interceptor, but people
# are concerned with the name "interceptor" though I prefer it)
class Plugin:
  def create_worker(self, config: WorkerConfig, next: Plugin) -> Worker:
    # Default impl calls next
    
  async def run_worker(self, worker: Worker, next: Plugin) -> None:
	  # Default impl calls next

For example:

class MyPlugin(client.Plugin, worker.Plugin, client.Interceptor, worker.Interceptor):
  def create_client(self, config: ClientCreateConfig, next: Plugin) -> Client:
    # Say you want to set data converter and interceptor
    config["data_converter"] = MyDataConverter()
    config["interceptors"].append(self)
    return super().create_client(config, next)
    
  def create_worker(self, config: WorkerCreateConfig, next: Plugin) -> Worker:
    # Say you want an activity
    config["activities"].append(MyActivity())
    return super().create_worker(config, next)
    
  async def run_worker(self, worker: Worker, next: Plugin) -> None:
    try:
      await super().run_worker(worker, next)
    finally:
      # Say you want to do something on worker shutdown
      do_some_cleanup()
      
  def intercept_activity(self, next: ActivityInboundInterceptor) -> ActivityInboundInterceptor:
    # Say you want to intercept activities
    return MyActivityInterceptor(next)
Additional context
Per-SDK Tickets

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the per-SDK tickets linked in the issue, especially Python issue 950 and pull request 1011, before choosing an implementation target. Compare which SDKs already have work underway; done requires a decided plugin model and coordinated SDK-specific support rather than an isolated change.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, go, java, php, python, ruby, typescript
Domain
api, backend-api-design, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.