From ced818e1dc6912db4305b9fe4d1fd9628dd93042 Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Thu, 1 Aug 2024 17:18:32 -0400 Subject: [PATCH] Changes required for compatibility with new Orkes client --- build.gradle | 17 +++-------------- src/main/java/io/orkes/samples/Main.java | 14 +++++++++----- .../orkes/samples/workers/ApprovalWorker.java | 6 +++--- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 3dbdef4..521956b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,12 +7,12 @@ group 'io.orkes.conductor.workers' version '1.0-SNAPSHOT' repositories { + mavenLocal() mavenCentral() } ext { - conductorVersion = '3.13.8' - conductorClientVersion = '2.0.7' + conductorClientVersion = '3.0.0-alpha2' log4jVersion = '2.17.2!!' jacksonVersion = '2.13.2!!' lombokVersion = '1.18.28' @@ -25,19 +25,14 @@ java { } dependencies { - implementation "com.netflix.conductor:conductor-client:${conductorVersion}" - implementation "com.netflix.conductor:conductor-common:${conductorVersion}" - implementation "io.orkes.conductor:orkes-conductor-client:${conductorClientVersion}" + implementation "io.orkes.conductor:client:${conductorClientVersion}" implementation "org.apache.logging.log4j:log4j-api:${log4jVersion}" implementation "org.apache.logging.log4j:log4j-core:${log4jVersion}" - implementation "org.apache.logging.log4j:log4j-jul:${log4jVersion}" - implementation "org.apache.logging.log4j:log4j-web:${log4jVersion}" implementation "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}" implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}" - implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}" implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:${jacksonVersion}" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}" implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jacksonVersion}" @@ -53,12 +48,6 @@ test { useJUnitPlatform() } -configurations { - all { - exclude group: 'com.github.vmg.protogen', module: 'protogen-annotations' - } -} - application { mainClassName = 'io.orkes.samples.Main' } \ No newline at end of file diff --git a/src/main/java/io/orkes/samples/Main.java b/src/main/java/io/orkes/samples/Main.java index d77ac73..98469d0 100644 --- a/src/main/java/io/orkes/samples/Main.java +++ b/src/main/java/io/orkes/samples/Main.java @@ -1,14 +1,13 @@ package io.orkes.samples; -import io.orkes.conductor.client.ApiClient; -import io.orkes.conductor.client.OrkesClients; -import io.orkes.conductor.client.TaskClient; +import io.orkes.conductor.client.api.TaskClient; import io.orkes.conductor.client.automator.TaskRunnerConfigurer; +import io.orkes.conductor.client.http.clients.OrkesHttpClient; +import io.orkes.conductor.client.http.clients.OrkesTaskClient; import io.orkes.samples.workers.ApprovalWorker; import java.util.List; - public class Main { private static final String ROOT_URI = "http://localhost:8080/api"; private static final String KEY = "_CHANGE_ME_"; @@ -24,6 +23,11 @@ public static void main(String[] args) { } private static TaskClient getTaskClient() { - return new OrkesClients(new ApiClient(ROOT_URI, KEY, SECRET)).getTaskClient(); + OrkesHttpClient client = OrkesHttpClient.builder() + .basePath(ROOT_URI) + .keyId(KEY) + .keySecret(SECRET) + .build(); + return new OrkesTaskClient(client); } } diff --git a/src/main/java/io/orkes/samples/workers/ApprovalWorker.java b/src/main/java/io/orkes/samples/workers/ApprovalWorker.java index f81f896..e0ed588 100644 --- a/src/main/java/io/orkes/samples/workers/ApprovalWorker.java +++ b/src/main/java/io/orkes/samples/workers/ApprovalWorker.java @@ -1,9 +1,9 @@ package io.orkes.samples.workers; import com.fasterxml.jackson.dataformat.xml.XmlMapper; -import com.netflix.conductor.client.worker.Worker; -import com.netflix.conductor.common.metadata.tasks.Task; -import com.netflix.conductor.common.metadata.tasks.TaskResult; +import io.orkes.conductor.client.model.metadata.tasks.Task; +import io.orkes.conductor.client.model.metadata.tasks.TaskResult; +import io.orkes.conductor.client.worker.Worker; import lombok.SneakyThrows; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;