temporalio / temporalio/temporal
Optional Activities
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.2k
- Forks
- 1.9k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
Currently workflows are hard to easily extend when adding new activities calls without any meaningful activity result for the workflow. This is because a workflow needs to be deterministic thus adding/removing activities will break determinism.
Describe the solution you'd like
We would like to have an ability to mark an activity call as "optional", meaning that if we add or remove activity invocation from a workflow the workflow replay wont cause any determinism issue. This is only possible when the workflow is not depending on the result of the activity. This is especially useful when you have fire&forget kind of activities (like publishing messages, notifying other services, fan-outs, etc).
An potential example could be:
const activitiesFn = [
(payload: string) => activityA(payload),
(payload: string) => activityB(payload),
(payload: string) => activityC(payload),
// possibility to just add additional activityFn without breaking determinism
// (payload: string) => activityD(payload),
];
export async function activitiesWorkflow() {
const someEvent = 'abc';
await Promise.all(activitiesFn.map((fn) => fn(someEvent)));
}
Describe alternatives you've considered
Publishing an single event and create own listeners which listen to the published event and react upon. This however requires own infra/queue/listeners setup to do fanout.
Additional context
Slack: https://temporalio.slack.com/archives/CTRCR8RBP/p1725981611435449
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
The issue provides no file, test, or entry point; start by locating Temporal's workflow determinism and activity-invocation implementation and its replay tests. Use the TypeScript example to clarify how optional fire-and-forget activities should be represented and handled when calls are added or removed, then define tests that establish the expected replay behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, typescript
- Domain
- backend-api-design, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100