Skip to content

Commit

Permalink
IWF-119: Add workflowAlreadyStartedOptions (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski authored Oct 31, 2024
1 parent 71172ee commit c584c4a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion iwf-idl
1 change: 1 addition & 0 deletions src/main/java/io/iworkflow/core/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public String startWorkflow(
unregisterWorkflowOptions.workflowConfigOverride(options.getWorkflowConfigOverride());
unregisterWorkflowOptions.waitForCompletionStateExecutionIds(options.getWaitForCompletionStateExecutionIds());
unregisterWorkflowOptions.waitForCompletionStateIds(options.getWaitForCompletionStateIds());
unregisterWorkflowOptions.workflowAlreadyStartedOptions(options.getWorkflowAlreadyStartedOptions());

final Map<String, SearchAttributeValueType> saTypes = registry.getSearchAttributeKeyToTypeMap(wfType);
final List<SearchAttribute> convertedSAs = convertToSearchAttributeList(saTypes, options.getInitialSearchAttribute());
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/iworkflow/core/UnregisteredClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.iworkflow.gen.models.PersistenceLoadingPolicy;
import io.iworkflow.gen.models.SearchAttributeKeyAndType;
import io.iworkflow.gen.models.StateCompletionOutput;
import io.iworkflow.gen.models.WorkflowAlreadyStartedOptions;
import io.iworkflow.gen.models.WorkflowGetDataObjectsRequest;
import io.iworkflow.gen.models.WorkflowGetDataObjectsResponse;
import io.iworkflow.gen.models.WorkflowGetRequest;
Expand Down Expand Up @@ -170,6 +171,10 @@ public String startWorkflow(
startOptions.useMemoForDataAttributes(options.getUsingMemoForDataAttributes().get());
}

if (options.getWorkflowAlreadyStartedOptions().isPresent()) {
startOptions.workflowAlreadyStartedOptions(options.getWorkflowAlreadyStartedOptions().get());
}

request.workflowStartOptions(startOptions);

request.waitForCompletionStateExecutionIds(options.getWaitForCompletionStateExecutionIds());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.iworkflow.gen.models.IDReusePolicy;
import io.iworkflow.gen.models.SearchAttribute;
import io.iworkflow.gen.models.WorkflowAlreadyStartedOptions;
import io.iworkflow.gen.models.WorkflowConfig;
import io.iworkflow.gen.models.WorkflowRetryPolicy;
import io.iworkflow.gen.models.WorkflowStateOptions;
Expand Down Expand Up @@ -31,4 +32,6 @@ public abstract class UnregisteredWorkflowOptions {
public abstract List<String> getWaitForCompletionStateExecutionIds();

public abstract List<String> getWaitForCompletionStateIds();

public abstract Optional<WorkflowAlreadyStartedOptions> getWorkflowAlreadyStartedOptions();
}
3 changes: 3 additions & 0 deletions src/main/java/io/iworkflow/core/WorkflowOptions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.iworkflow.core;

import io.iworkflow.gen.models.IDReusePolicy;
import io.iworkflow.gen.models.WorkflowAlreadyStartedOptions;
import io.iworkflow.gen.models.WorkflowConfig;
import io.iworkflow.gen.models.WorkflowRetryPolicy;
import org.immutables.value.Value;
Expand All @@ -26,6 +27,8 @@ public abstract class WorkflowOptions {
public abstract List<String> getWaitForCompletionStateIds();
public abstract List<String> getWaitForCompletionStateExecutionIds();

public abstract Optional<WorkflowAlreadyStartedOptions> getWorkflowAlreadyStartedOptions();

public static WorkflowOptionBuilderExtension extendedBuilder() {
return new WorkflowOptionBuilderExtension();
}
Expand Down

0 comments on commit c584c4a

Please sign in to comment.