Skip to content

Merging ActivityOptions fails with UnsupportedOperationException when using immutable lists for context propagators #2482

Open
@antmendoza

Description

@antmendoza

Is your feature request related to a problem? Please describe.

Merging ActivityOptions fails here with UnsupportedOperationException when using immutable lists for context propagators

Steps to Reproduce the Problem

Create a worker with WorkflowImplementationOptions and set setContextPropagators as an immutable list for one of the activities.

 WorkflowImplementationOptions options =
        WorkflowImplementationOptions.newBuilder()
            .setActivityOptions(
                ImmutableMap.of(
                    "ActivityTypeB",
                    ActivityOptions.newBuilder()
                        // Set activity exec timeout (single run)
                        .setStartToCloseTimeout(Duration.ofSeconds(2))
                        .setRetryOptions(
                            RetryOptions.newBuilder()
                                // ActivityTypeB activity type shouldn't retry on NPE
                                .setDoNotRetry(NullPointerException.class.getName())
                                .build())
                        .setContextPropagators(List.of(new MDCContextPropagator()))
                        .build()))
            .build();

for the same activity, set the context propagator as an immutable list in the activityStub


  private FailingActivities activities =
      Workflow.newActivityStub(
          FailingActivities.class,
          ActivityOptions.newBuilder()
              .setContextPropagators(List.of(new MDCContextPropagator2()))
              .build());

The worker throws an UnsupportedOperationException here when it tries to schedule the activity.

Describe the solution you'd like

Create a new list that combines both instead of modifying one of them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions