Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.temporal.internal.nexus.CurrentNexusOperationContext;
import io.temporal.internal.nexus.InternalNexusOperationContext;
import io.temporal.internal.nexus.NexusOperationMetadata;
import io.temporal.payload.context.ActivitySerializationContext;
import io.temporal.serviceclient.StatusUtils;
import java.lang.reflect.Type;
import java.util.*;
Expand Down Expand Up @@ -63,7 +64,18 @@ public StartActivityOutput startActivity(StartActivityInput input) {
if (Strings.isNullOrEmpty(options.getTaskQueue())) {
throw new IllegalArgumentException("taskQueue must not be null or empty");
}
DataConverter dc = clientOptions.getDataConverter();
DataConverter dc =
clientOptions
.getDataConverter()
.withContext(
new ActivitySerializationContext(
clientOptions.getNamespace(),
null,
null,
input.getActivityType(),
options.getTaskQueue(),
false));

InternalNexusOperationContext nexusContext =
CurrentNexusOperationContext.isNexusContext() ? CurrentNexusOperationContext.get() : null;
NexusOperationMetadata nexusOperationMetadata =
Expand Down Expand Up @@ -185,7 +197,11 @@ public StartActivityOutput startActivity(StartActivityInput input) {
public <R> GetActivityResultOutput<R> getActivityResult(GetActivityResultInput<R> input)
throws TimeoutException {
String namespace = clientOptions.getNamespace();
DataConverter dc = clientOptions.getDataConverter();
DataConverter dc =
clientOptions
.getDataConverter()
.withContext(
new ActivitySerializationContext(namespace, null, null, null, null, false));
Deadline deadline = Deadline.after(input.getTimeout(), input.getTimeoutUnit());

while (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,34 @@ public class ActivitySerializationContext implements HasWorkflowSerializationCon
private final @Nonnull String namespace;
private final @Nullable String workflowId;
private final @Nullable String workflowType;
private final @Nonnull String activityType;
private final @Nonnull String activityTaskQueue;
private final @Nullable String activityType;
private final @Nullable String activityTaskQueue;
private final boolean local;

/**
* @param namespace the activity's namespace; must not be {@code null}
* @param workflowId the workflow ID that scheduled the activity, or {@code null} for standalone
* activities (stored as an empty string)
* activities
* @param workflowType the workflow type that scheduled the activity, or {@code null} for
* standalone activities (stored as an empty string)
* @param activityType the activity type name; must not be {@code null}
* @param activityTaskQueue the task queue for this activity; must not be {@code null}
* standalone activities
* @param activityType the activity type name, or {@code null} if unknown. Activity type is
* unknown when getting a Standalone Activity result.
* @param activityTaskQueue the task queue for this activity, or {@code null} if unknown. Task
* queue is unknown when getting a Standalone Activity result.
* @param local {@code true} if this is a local activity
*/
public ActivitySerializationContext(
@Nonnull String namespace,
@Nullable String workflowId,
@Nullable String workflowType,
@Nonnull String activityType,
@Nonnull String activityTaskQueue,
@Nullable String activityType,
@Nullable String activityTaskQueue,
boolean local) {
this.namespace = Objects.requireNonNull(namespace);
this.workflowId = workflowId;
this.workflowType = workflowType;
this.activityType = Objects.requireNonNull(activityType);
this.activityTaskQueue = Objects.requireNonNull(activityTaskQueue);
this.activityType = activityType;
this.activityTaskQueue = activityTaskQueue;
this.local = local;
}

Expand Down Expand Up @@ -67,12 +69,12 @@ public String getWorkflowType() {
return workflowType;
}

@Nonnull
@Nullable
public String getActivityType() {
return activityType;
}

@Nonnull
@Nullable
public String getActivityTaskQueue() {
return activityTaskQueue;
}
Expand Down
Loading