Skip to content

Commit

Permalink
Merge branch 'main' into workflow_apis
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r3n committed Jan 29, 2024
2 parents 2f28255 + ad5b2d4 commit 2d72688
Show file tree
Hide file tree
Showing 18 changed files with 438 additions and 162 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ext {
versions = [
awaitility : '4.2.0',
commonsLang : '3.12.0',
conductor : '3.9.28-orkes',
conductor : '3.9.24-orkes',
jackson : '2.11.4!!',
junit : '5.9.0',
slf4j : '1.7.36',
Expand All @@ -47,7 +47,9 @@ dependencies {

api ("io.orkes.conductor:conductor-common:${versions.conductor}")
api ("io.orkes.conductor:conductor-grpc:${versions.conductor}")
api ("io.orkes.conductor:conductor-java-sdk:${versions.conductor}")
api ("io.orkes.conductor:conductor-java-sdk:${versions.conductor}") {
exclude group: 'com.netflix.conductor'
}
implementation 'javax.annotation:javax.annotation-api:1.3.2'

implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:${versions.jackson}"
Expand Down Expand Up @@ -98,7 +100,6 @@ dependencies {
implementation "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}!!"
implementation "org.apache.logging.log4j:log4j-jul:${versions.log4j}!!"
implementation "org.apache.logging.log4j:log4j-web:${versions.log4j}!!"
//implementation "org.apache.logging.log4j:log4j-to-slf4j:${versions.log4j}!!"

//spring
implementation "org.springframework:spring-context:5.3.24"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.0.0
version=2.0.9
8 changes: 8 additions & 0 deletions src/main/java/io/orkes/conductor/client/EventClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@



import java.util.List;
import java.util.Map;

import com.netflix.conductor.common.metadata.events.EventHandler;

import io.orkes.conductor.client.model.event.QueueConfiguration;

public abstract class EventClient extends com.netflix.conductor.client.http.EventClient {
Expand All @@ -24,4 +27,9 @@ public abstract class EventClient extends com.netflix.conductor.client.http.Even
public abstract void deleteQueueConfig(QueueConfiguration queueConfiguration);

public abstract void putQueueConfig(QueueConfiguration queueConfiguration) throws Exception;

public abstract List<EventHandler> getEventHandlers();

public abstract void handleIncomingEvent(Map<String, Object> payload);

}
15 changes: 15 additions & 0 deletions src/main/java/io/orkes/conductor/client/WorkflowClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.netflix.conductor.common.run.WorkflowTestRequest;

import io.orkes.conductor.client.http.ApiException;
import io.orkes.conductor.client.model.WorkflowStateUpdate;
import io.orkes.conductor.client.model.WorkflowStatus;
import io.orkes.conductor.common.model.WorkflowRun;

Expand Down Expand Up @@ -93,4 +94,18 @@ public abstract Map<String, List<Workflow>> getWorkflowsByNamesAndCorrelationIds
public abstract Workflow updateVariables(String workflowId, Map<String, Object> variables);

public abstract void upgradeRunningWorkflow(String workflowId, UpgradeWorkflowRequest body);

/**
*
* Update a runningw workflow by updating its variables or one of the scheduled task identified by task reference name
* @param workflowId Id of the workflow to be updated
* @param waitUntilTaskRefNames List of task reference names to wait for. The api call will wait for ANY of these tasks to be availble in workflow.
* @param waitForSeconds Maximum time to wait for. If the workflow does not complete or reach one of the tasks listed in waitUntilTaskRefNames by this time,
* the call will return with the current status of the workflow
* @param updateRequest Payload for updating state of workflow.
*
* @return
*/
public abstract WorkflowRun updateWorkflow(String workflowId, List<String> waitUntilTaskRefNames, Integer waitForSeconds,
WorkflowStateUpdate updateRequest);
}
10 changes: 10 additions & 0 deletions src/main/java/io/orkes/conductor/client/http/OrkesEventClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ public List<EventHandler> getEventHandlers(String event, boolean activeOnly) {
return eventResourceApi.getEventHandlersForEvent(event, activeOnly);
}

@Override
public List<EventHandler> getEventHandlers() {
return eventResourceApi.getEventHandlers();
}

@Override
public void handleIncomingEvent(Map<String, Object> payload) {
eventResourceApi.handleIncomingEvent(payload);
}

@Override
public void unregisterEventHandler(String name) {
eventResourceApi.removeEventHandlerStatus(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.orkes.conductor.client.http.api.WorkflowBulkResourceApi;
import io.orkes.conductor.client.http.api.WorkflowResourceApi;
import io.orkes.conductor.client.model.CorrelationIdsSearchRequest;
import io.orkes.conductor.client.model.WorkflowStateUpdate;
import io.orkes.conductor.client.model.WorkflowStatus;
import io.orkes.conductor.common.model.WorkflowRun;

Expand Down Expand Up @@ -346,6 +347,15 @@ public void upgradeRunningWorkflow(String workflowId, UpgradeWorkflowRequest upg
httpClient.upgradeRunningWorkflow(upgradeWorkflowRequest, workflowId);
}

@Override
public WorkflowRun updateWorkflow(String workflowId, List<String> waitUntilTaskRefNames, Integer waitForSeconds, WorkflowStateUpdate updateRequest) {
String joinedReferenceNames = "";
if (waitUntilTaskRefNames != null) {
joinedReferenceNames = String.join(",", waitUntilTaskRefNames);
}
return httpClient.updateWorkflowState(updateRequest, UUID.randomUUID().toString(), workflowId, joinedReferenceNames, waitForSeconds);
}

@Override
public void close() {
shutdown();
Expand Down
Loading

0 comments on commit 2d72688

Please sign in to comment.