Skip to content

Commit

Permalink
Make Sub workflow Priority Object to support parametrised priority
Browse files Browse the repository at this point in the history
  • Loading branch information
manan164 committed Nov 29, 2024
1 parent c67b2eb commit 40db991
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class SubWorkflowParams {
private IdempotencyStrategy idempotencyStrategy;

// Priority of the sub workflow, not set inherits from the parent
private Integer priority;
private Object priority;

public String getIdempotencyKey() {
return idempotencyKey;
Expand All @@ -64,11 +64,11 @@ public void setIdempotencyStrategy(IdempotencyStrategy idempotencyStrategy) {
this.idempotencyStrategy = idempotencyStrategy;
}

public Integer getPriority() {
public Object getPriority() {
return priority;
}

public void setPriority(Integer priority) {
public void setPriority(Object priority) {
this.priority = priority;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.util.*;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -83,8 +84,9 @@ public List<TaskModel> getMappedTasks(TaskMapperContext taskMapperContext) {
subWorkflowTask.addInput("workflowInput", taskMapperContext.getTaskInput());
subWorkflowTask.setStatus(TaskModel.Status.SCHEDULED);
subWorkflowTask.setCallbackAfterSeconds(workflowTask.getStartDelay());
if (subWorkflowParams.getPriority() != null) {
subWorkflowTask.setWorkflowPriority(subWorkflowParams.getPriority());
if (subWorkflowParams.getPriority() != null && !StringUtils.isEmpty(subWorkflowParams.getPriority().toString())) {
int priority = Integer.parseInt(subWorkflowParams.getPriority().toString());
subWorkflowTask.setWorkflowPriority(priority);
}
LOGGER.debug("SubWorkflowTask {} created to be Scheduled", subWorkflowTask);
return List.of(subWorkflowTask);
Expand Down

0 comments on commit 40db991

Please sign in to comment.