Skip to content

Use native Nexus serialization context for async sample results - #815

Open
litlep-nibbyt wants to merge 7 commits into
mainfrom
codex/java-per-endpoint-encryption
Open

litlep-nibbyt wants to merge 7 commits into
mainfrom
codex/java-per-endpoint-encryption

Conversation

@litlep-nibbyt

@litlep-nibbyt litlep-nibbyt commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Update the per-endpoint encryption sample to use SDK-provided Nexus serialization context for workflow-backed async results, replacing the custom interceptor and workflow-header propagation workaround.

Expand the sample from two endpoints to four, adding one endpoint and a second key to each handler. Each endpoint uses a distinct AES-GCM key. The compressed/encrypted handler applies zlib before encryption; the other handler encrypts without compression. The caller and each handler use separate, descriptively named namespaces. A dedicated caller workflow key protects its ordinary input and final result independently of the four endpoint keys.

Keep the eight sync/async calls and result fields explicit. Update the README’s endpoint/key mappings and local setup, keeping the prerelease CLI separate from the stable installation. Keep codec tests focused on sample configuration.

Validation:

  • Four codec tests and core formatting checks pass with SDK 1.40.0.
  • All eight calls pass across three namespaces using SDK source commit 11cc5743 and CLI v1.9.3-nexus-serialization-context.
  • Backing-workflow histories confirm stored Nexus context and expected encryption metadata. Caller history confirms its separate workflow key.
  • Manual checks reject all 12 wrong-key pairings, including after relabelling the metadata.

@@ -0,0 +1,175 @@
package io.temporal.samples.nexusserializationcontext;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a bit tedious and possibly flaky need to reassess whether its worth keeping

() -> handlerA.fromPayload(requestB, String.class, String.class));
}

@Test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seemed unnecessary because it tests the old workaround

@litlep-nibbyt
litlep-nibbyt marked this pull request as ready for review November 12, 2026 20:30
@litlep-nibbyt
litlep-nibbyt requested review from a team as code owners November 12, 2026 20:30
Use a Temporal Server that supports Nexus serialization-context propagation for
workflow-backed asynchronous operations. For local development, download
[Temporal CLI `v1.9.3-nexus-serialization-context`](https://github.com/temporalio/cli/releases/tag/v1.9.3-nexus-serialization-context)
and add its `temporal` binary to your `PATH`. Its dev server includes this support.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid telling users to put this prerelease CLI on their PATH? It replaces their stable temporal with a build that embeds an unreleased server from main.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example of what we can do for this

@JoshuaFrenchwood

Copy link
Copy Markdown
Contributor

Can also update this sample to show CompressedEncryptedHandlerWorker and EncryptedHandlerWorker using more than one key, and picking which to use based on the Nexus Endpoint? This is now possible async and sync operations

Serve two endpoints per handler with distinct keys in one namespace.
Keep sync and async calls explicit, simplify the sample codec tests,
and remove the dev-server integration test.
Name endpoints, keys, task queues, and results by their encoding chain.
Use a dedicated caller workflow key while retaining the four endpoint
keys and their existing secret values. Update the README and codec tests.
Keep each handler in its own namespace using descriptive encoding names.
Update local setup commands, the namespace table, and caller test context.
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.

2 participants