temporalio / temporalio/sdk-java
ContextPropagator redesign
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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