Skip to content

Activity options merging logic is not correct #2042

@mfateev

Description

@mfateev

Expected Behavior

There are six potential sources for activity options:

  1. WorkflowImplementationOptions#defaultActivityOptions
  2. WorkflowImplementationOptions#activityOptions map
  3. Workflow.setDefaultActivityOptions
  4. Workflow.applyActivityOptions map
  5. options argument passed to WorkflowInternal#newActivityStub
  6. activityMethodOptions map argument passed to WorkflowInternal#newActivityStub

When all these options are specified for the given activity type, the logical behavior is to merge them in the same order as specified above.

Actual Behavior

The current logic is split between:

options = (options == null) ? context.getDefaultActivityOptions() : options;

and

The short description is:

  1. options = options argument passed to [WorkflowInternal#newActivityStub] ? WorkflowImplementationOptions#defaultActivityOptions // not that they are not merged if the argument is present.

  2. WorkflowImplementationOptions#activityOptions map is overridden by options found in activityMethodOptions map argument passed to WorkflowInternal#newActivityStub

  3. options (from step 1) are overridden by a value (with the key equal to the activity type) from the map generated by step (2)

I believe that we should fix the merging logic to match the intuitive behavior explained in the "Expected Behavior" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions