temporalio / temporalio/sdk-java

ContextPropagator redesign

Open
#1,644 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Is your feature request related to a problem? Please describe.
The current Context propagator interface doesn't have an access to a reference to an entity it propagates to. For example a workflow or an activity instance. This doesn't allow the Context Propagator to get access to setters in the class.
ContextPropagator also is not aware if it propagates into a workflow or an activity at all, which makes it impossible to decide it WorkflowThreadLocal (WorkflowLocal) or a regular ThreadLocal should be used.
See
If ThreadLocal is used, ContextPropagator should have a lifecycle method to be able to clean the ThreadLocal. For example, a method that will be triggered at the end of an activity method.

Describe the solution you'd like
ContextPropagator should be reimplemented as Interceptors from scratch and its design should be reimplemented taking into account the points mentioned above.
See #525 for a proposed alternative to having ContextPropagator form a separate context that is accessible from Workflow and Activity code.

Additional context
The right approach would be a creation of a completely new ContextPropagator interface while leaving the old ContextPropagator in place, and deprecating it.

Contributor guide

Open the contributing guide

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

Start by reading the existing ContextPropagator interface and the interceptor design, then review issue #525 for the proposed alternative. Identify how workflow and activity targets, lifecycle cleanup, and backward compatibility should be represented. Done means a new ContextPropagator interface is defined, the old one remains and is deprecated, and the redesign addresses the stated propagation and cleanup cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
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.