Skip to content

[Feature Request] Add workflow API to create independent deterministic pseudo-number sequence #1895

@mjameswh

Description

@mjameswh

Context

  • Some Workflow Plugins need to call Math.random() or workflow.uuid4().
  • If the workflow code also use these methods, then the plugin and the workflow code both pull values out of the same PRNG sequence.
  • That may result in NDEs if a workflow is replayed after adding/removing a Plugin.

Describe the solution you'd like

Add the following to the Workflow API:

  1. API to create a distinct deterministic PRNG instance
  2. Possibility of generating UUIDs from that distinct PRNG instances (i.e. rather than only from the workflow’s global PRNG).
  3. Possibility of activating a given PRNG instance as the “global” one within a given execution scope. This is required to ensure that third-party, non-Temporal libraries used by Temporal plugins don’t disrupt the workflow’s actual PRNG sequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions