Skip to content

feat(visitors): message and concurrent payload visitors#2902

Draft
jmaeagle99 wants to merge 1 commit into
masterfrom
ja/payload-visitor
Draft

feat(visitors): message and concurrent payload visitors#2902
jmaeagle99 wants to merge 1 commit into
masterfrom
ja/payload-visitor

Conversation

@jmaeagle99
Copy link
Copy Markdown
Contributor

What was changed

Adds an SDK-internal payload/message visitor for Temporal API proto messages (io.temporal.internal.payload.visitor in temporal-sdk).

  • PayloadVisitors.visit(message, options) — invokes a callback on every Payload reachable in any API message; the callback returns replacements, so payloads can be transformed in place.
  • MessageVisitors.visit(message, options) — invokes a callback on each payload-bearing message (no per-payload visiting), for per-message-type logic.
  • Per-message context seam (MessageVisitor) that threads a scoped value down the tree — e.g. tag payloads with the enclosing command's info.
  • Bounded concurrency: sequential by default; concurrency > 1 requires a caller-supplied Executor.
  • Handles all payload shapes, google.protobuf.Any, and cyclic messages (Failure).
  • Visitor exceptions propagate unchanged to the caller.

The traversal code is generated at build time from the proto descriptors (new payloadVisitorGenerator source set + Gradle task; output under build/generated, not committed).

Why?

Provides the shared traversal foundation the upcoming external storage feature needs (concurrently offload large payloads), and the planned payload-limits validator.

Checklist

  1. Closes Enable concurrent payload visiting - Java #2881 Allow payload visitors to visit memo payloads in aggregate - Java #2884

  2. How was this tested: Unit tests under io.temporal.internal.payload.visitor (PayloadVisitorTest, MessageVisitorTest) covering traversal/mutation across every field shape, Any, cyclic messages, scoped context, concurrency, and error propagation

  3. Any docs updates needed? No, internal implementation.

@jmaeagle99 jmaeagle99 changed the title feat: message and concurrent payload visitors feat(visitors): message and concurrent payload visitors Jun 6, 2026
@jmaeagle99 jmaeagle99 force-pushed the ja/payload-visitor branch from 25b02f3 to 67d651e Compare June 6, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable concurrent payload visiting - Java

1 participant