Class OperationIdGenerator

java.lang.Object
software.amazon.lambda.durable.execution.OperationIdGenerator

public class OperationIdGenerator extends Object
Generates operation IDs for the durable operations.
  • Constructor Details

    • OperationIdGenerator

      public OperationIdGenerator(String contextId)
  • Method Details

    • hashOperationId

      public static String hashOperationId(String rawId)
      Hashes the given string using SHA-256
      Parameters:
      rawId - the string to hash
      Returns:
      the hashed string
    • nextOperationId

      public String nextOperationId()
      Returns the next globally unique operation ID. Increments an internal counter, concatenates it with the context ID prefix (contextId + "-" + counter), and SHA-256 hashes the result. For root contexts the prefix is the EXECUTION operation ID; for child contexts it is the parent's hashed context ID. This produces IDs like hash("execId-1"), hash("execId-2") at the root level, and hash("<parentHash>-1"), hash("<parentHash>-2") inside a child context.