Skip to content

💥 Use ActivitySerializationContext when starting and getting result of Standalone Activity - #3063

Open
maciejdudko wants to merge 6 commits into
temporalio:mainfrom
maciejdudko:saa-serialization-context
Open

maciejdudko wants to merge 6 commits into
temporalio:mainfrom
maciejdudko:saa-serialization-context

Conversation

@maciejdudko

Copy link
Copy Markdown
Contributor

💥 BREAKING CHANGE

ActivitySerializationContext.activityType and activityTaskQueue are now @Nullable because they are unavailable when fetching result.

What was changed

  • Added ActivitySerializationContext to DataConverter used for de/serialization of payloads in ActivityClient.start and ActivityHandle.getResult.
  • Changed ActivitySerializationContext.activityType and activityTaskQueue to @Nullable.

Why?

Makes it possible to use context-aware data converters with Standalone Activities.

@maciejdudko
maciejdudko requested a review from a team as a code owner September 10, 2026 18:46
@maciejdudko maciejdudko changed the title Use ActivitySerializationContext when starting and getting result of Standalone Activity 💥 Use ActivitySerializationContext when starting and getting result of Standalone Activity Sep 10, 2026
throws TimeoutException {
String namespace = clientOptions.getNamespace();
DataConverter dc = clientOptions.getDataConverter();
DataConverter dc =

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.

Hmm, technically here we can know the task queue if the handle was created by a start or execute call and we would often know the type if the user created the handle with the typed API

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.

Standalone Activities can have task queue changed after start. Really we should deprecate task queue in serialization context altogether.

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.

I think there is some value in task queue since users can have different data converters on different task queues so I wouldn't want to deprecate it IMO, but I can understand not wanting to assume it.

* queue is unknown when getting a Standalone Activity result.
* @param local {@code true} if this is a local activity
*/
public ActivitySerializationContext(

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.

Interesting we don't have activity ID here 🤔

@Quinn-With-Two-Ns

Copy link
Copy Markdown
Contributor

Shouldn't we have at least one test to show starting a Standalone activity uses the context?

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.

Does the async path need to change too?

Suggested change
DataConverter dc =
clientOptions
.getDataConverter()
.withContext(
new ActivitySerializationContext(
clientOptions.getNamespace(), null, null, null, null, false));

@maciejdudko maciejdudko Sep 16, 2026

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.

Yes, good find! Fixed.

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.

3 participants