From b748dcece2d12492fbc34e10f4a14e949b7a9175 Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 10:39:20 -0300 Subject: [PATCH 1/6] conductor-client fat jar file name should be conductor-client-$version-all.jar --- .../java/conductor-java-sdk/conductor-client/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conductor-clients/java/conductor-java-sdk/conductor-client/build.gradle b/conductor-clients/java/conductor-java-sdk/conductor-client/build.gradle index 312129fa4..7a420745b 100644 --- a/conductor-clients/java/conductor-java-sdk/conductor-client/build.gradle +++ b/conductor-clients/java/conductor-java-sdk/conductor-client/build.gradle @@ -39,7 +39,7 @@ test { } shadowJar { - archiveFileName = "orkes-conductor-client-$version-all.jar" + archiveFileName = "conductor-client-$version-all.jar" mergeServiceFiles() } From 63d021917c4d2aad0fd1ffc5c6aa963c5c2d1a17 Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 10:43:36 -0300 Subject: [PATCH 2/6] Publish Config Plugin: use project.hasProperty('artifactId') instead of project.ext.has('artifactId') --- .../io/orkes/conductor/gradle/PublishConfigPlugin.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy b/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy index 8f7c1d0f4..6e1f0575d 100644 --- a/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy +++ b/conductor-clients/java/conductor-java-sdk/buildSrc/src/main/groovy/io/orkes/conductor/gradle/PublishConfigPlugin.groovy @@ -25,8 +25,8 @@ class PublishConfigPlugin implements Plugin { private publicationConfig(Project project) { return { mavenJava(MavenPublication) { - if (project.ext.has('artifactId')) { - artifactId = project.ext.artifactId + if (project.hasProperty('artifactId')) { + artifactId = project.findProperty('artifactId') } from project.components.java From 9f7c0098f9fd63c1f7662715e50dc8ae46f8152a Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 10:45:12 -0300 Subject: [PATCH 3/6] changed orkes client and orkes spring module maven artifact coordinates --- .../java/conductor-java-sdk/orkes-client/build.gradle | 1 + .../java/conductor-java-sdk/orkes-spring/build.gradle | 1 + 2 files changed, 2 insertions(+) diff --git a/conductor-clients/java/conductor-java-sdk/orkes-client/build.gradle b/conductor-clients/java/conductor-java-sdk/orkes-client/build.gradle index 487e5ab66..701420e46 100644 --- a/conductor-clients/java/conductor-java-sdk/orkes-client/build.gradle +++ b/conductor-clients/java/conductor-java-sdk/orkes-client/build.gradle @@ -10,6 +10,7 @@ plugins { group = 'io.orkes.conductor' ext { + artifactId = 'orkes-conductor-client' artifactName = 'Orkes Conductor Client' artifactDescription = 'Orkes Conductor client (http)' } diff --git a/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle b/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle index c903ee0a5..eb30c76b7 100644 --- a/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle +++ b/conductor-clients/java/conductor-java-sdk/orkes-spring/build.gradle @@ -8,6 +8,7 @@ plugins { group = 'io.orkes.conductor' ext { + artifactId = 'orkes-conductor-client-spring' artifactName = 'Orkes Conductor Client/SDK Spring' artifactDescription = 'Spring autoconfig for Orkes Conductor Client and SDK' } From e8248387542b6a5d1f78eb0dd6fbbd4ce5560116 Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 10:47:27 -0300 Subject: [PATCH 4/6] we don't want to publish conductor-client-metrics yet --- .../conductor-client-metrics/build.gradle | 16 ++++++++-------- .../java/conductor-java-sdk/gradle.properties | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conductor-clients/java/conductor-java-sdk/conductor-client-metrics/build.gradle b/conductor-clients/java/conductor-java-sdk/conductor-client-metrics/build.gradle index 8b2065010..855a994b1 100644 --- a/conductor-clients/java/conductor-java-sdk/conductor-client-metrics/build.gradle +++ b/conductor-clients/java/conductor-java-sdk/conductor-client-metrics/build.gradle @@ -1,16 +1,16 @@ plugins { id 'java-library' id 'idea' - id 'maven-publish' - id 'signing' +// id 'maven-publish' +// id 'signing' } -ext { - artifactName = 'Conductor Client Metrics' - artifactDescription = 'Conductor Client Metrics' -} - -apply plugin: 'publish-config' +//ext { +// artifactName = 'Conductor Client Metrics' +// artifactDescription = 'Conductor Client Metrics' +//} +// +//apply plugin: 'publish-config' dependencies { implementation 'io.micrometer:micrometer-registry-prometheus:1.10.5' diff --git a/conductor-clients/java/conductor-java-sdk/gradle.properties b/conductor-clients/java/conductor-java-sdk/gradle.properties index a1b6e67b4..19a01881d 100644 --- a/conductor-clients/java/conductor-java-sdk/gradle.properties +++ b/conductor-clients/java/conductor-java-sdk/gradle.properties @@ -1 +1 @@ -version=4.0.0-alpha1-SNAPSHOT +version=4.0.0 From feca9026adbcb1c55484e96b6de5fdbc5a4d3818 Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 10:47:11 -0300 Subject: [PATCH 5/6] Added a null check for credentials during build time. This is a common mistake when getting these values from env variables for example. --- .../src/main/java/io/orkes/conductor/client/ApiClient.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conductor-clients/java/conductor-java-sdk/orkes-client/src/main/java/io/orkes/conductor/client/ApiClient.java b/conductor-clients/java/conductor-java-sdk/orkes-client/src/main/java/io/orkes/conductor/client/ApiClient.java index c7b8d449d..3d1ef30c5 100644 --- a/conductor-clients/java/conductor-java-sdk/orkes-client/src/main/java/io/orkes/conductor/client/ApiClient.java +++ b/conductor-clients/java/conductor-java-sdk/orkes-client/src/main/java/io/orkes/conductor/client/ApiClient.java @@ -150,6 +150,10 @@ public static ApiClientBuilder builder() { public static class ApiClientBuilder extends Builder { public ApiClientBuilder credentials(String key, String secret) { + if (key == null || secret == null) { + throw new IllegalArgumentException("Key and secret must not be null"); + } + this.addHeaderSupplier(new OrkesAuthentication(key, secret)); return this; } From 10e0a0ecbfdd7a224e7502d2c3e7dd31a426054f Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Wed, 9 Oct 2024 12:59:08 -0300 Subject: [PATCH 6/6] - Allow config of timeout and verify-ssl when creating default ApiClient in Spring AutoConfiguration - Support both "pollingInterval" and "poll_interval" for consistency in Annotated workers config --- .../spring/SpringWorkerConfiguration.java | 9 +++-- ...OrkesConductorClientAutoConfiguration.java | 35 +++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/conductor-clients/java/conductor-java-sdk/conductor-client-spring/src/main/java/com/netflix/conductor/client/spring/SpringWorkerConfiguration.java b/conductor-clients/java/conductor-java-sdk/conductor-client-spring/src/main/java/com/netflix/conductor/client/spring/SpringWorkerConfiguration.java index 8dce540e0..cb4d7b1ee 100644 --- a/conductor-clients/java/conductor-java-sdk/conductor-client-spring/src/main/java/com/netflix/conductor/client/spring/SpringWorkerConfiguration.java +++ b/conductor-clients/java/conductor-java-sdk/conductor-client-spring/src/main/java/com/netflix/conductor/client/spring/SpringWorkerConfiguration.java @@ -14,6 +14,7 @@ import org.springframework.core.env.Environment; +import com.netflix.conductor.client.worker.Worker; import com.netflix.conductor.sdk.workflow.executor.task.WorkerConfiguration; class SpringWorkerConfiguration extends WorkerConfiguration { @@ -26,7 +27,11 @@ public SpringWorkerConfiguration(Environment environment) { @Override public int getPollingInterval(String taskName) { - return getProperty(taskName, "pollingInterval", Integer.class, 0); + Integer pollingInterval = getProperty(taskName, "pollingInterval", Integer.class, 0); + if (pollingInterval == 0) { + pollingInterval = getProperty(taskName, Worker.PROP_POLL_INTERVAL, Integer.class, 0); + } + return pollingInterval; } @Override @@ -36,7 +41,7 @@ public int getThreadCount(String taskName) { @Override public String getDomain(String taskName) { - return getProperty(taskName, "domain", String.class, null); + return getProperty(taskName, Worker.PROP_DOMAIN, String.class, null); } private T getProperty(String taskName, String property, Class type, T defaultValue) { diff --git a/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java b/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java index 005096e46..acc602df6 100644 --- a/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java +++ b/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java @@ -34,17 +34,25 @@ @Slf4j public class OrkesConductorClientAutoConfiguration { + // Keeping these for backwards compatibility public static final String CONDUCTOR_SERVER_URL ="conductor.server.url"; public static final String CONDUCTOR_SECURITY_CLIENT_KEY_ID ="conductor.security.client.key-id"; public static final String CONDUCTOR_SECURITY_CLIENT_SECRET ="conductor.security.client.secret"; - //TODO add more properties e.g.: ssl off, timeout settings, etc. and these should be client properties!!! + + // Properties should be placed under "conductor.client" public static final String CONDUCTOR_CLIENT_BASE_PATH = "conductor.client.basepath"; public static final String CONDUCTOR_CLIENT_KEY_ID = "conductor.client.key-id"; public static final String CONDUCTOR_CLIENT_SECRET = "conductor.client.secret"; + public static final String CONDUCTOR_CLIENT_CONNECT_TIMEOUT = "conductor.client.timeout.connect"; + public static final String CONDUCTOR_CLIENT_READ_TIMEOUT = "conductor.client.timeout.read"; + public static final String CONDUCTOR_CLIENT_WRITE_TIMEOUT = "conductor.client.timeout.write"; + public static final String CONDUCTOR_CLIENT_VERIFYING_SSL = "conductor.client.verifying-ssl"; @Bean @ConditionalOnMissingBean public ApiClient orkesConductorClient(Environment env) { + ApiClient.ApiClientBuilder builder = ApiClient.builder(); + String basePath = env.getProperty(CONDUCTOR_CLIENT_BASE_PATH); if (basePath == null) { basePath = env.getProperty(CONDUCTOR_SERVER_URL); @@ -60,7 +68,30 @@ public ApiClient orkesConductorClient(Environment env) { secret = env.getProperty(CONDUCTOR_SECURITY_CLIENT_SECRET); } - return new ApiClient(basePath, keyId, secret); + Long connectTimeout = env.getProperty(CONDUCTOR_CLIENT_CONNECT_TIMEOUT, Long.class); + if (connectTimeout != null) { + builder.connectTimeout(connectTimeout); + } + + Long readTimeout = env.getProperty(CONDUCTOR_CLIENT_READ_TIMEOUT, Long.class); + if (readTimeout != null) { + builder.readTimeout(readTimeout); + } + + Long writeTimeout = env.getProperty(CONDUCTOR_CLIENT_WRITE_TIMEOUT, Long.class); + if (writeTimeout != null) { + builder.writeTimeout(writeTimeout); + } + + Boolean verifyingSsl = env.getProperty(CONDUCTOR_CLIENT_VERIFYING_SSL, Boolean.class); + if (verifyingSsl != null) { + builder.verifyingSsl(verifyingSsl); + } + + return builder + .basePath(basePath) + .credentials(keyId, secret) + .build(); } @Bean