Skip to content

Commit

Permalink
Merge pull request #280 from conductor-oss/fix/java-client-v4-misc-fixes
Browse files Browse the repository at this point in the history
[Java client v4] Misc fixes before v4.0.0 release
  • Loading branch information
jmigueprieto authored Oct 9, 2024
2 parents 1fed6c3 + 10e0a0e commit 0f23965
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class PublishConfigPlugin implements Plugin<Project> {
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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> T getProperty(String taskName, String property, Class<T> type, T defaultValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test {
}

shadowJar {
archiveFileName = "orkes-conductor-client-$version-all.jar"
archiveFileName = "conductor-client-$version-all.jar"
mergeServiceFiles()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=4.0.0-alpha1-SNAPSHOT
version=4.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
group = 'io.orkes.conductor'

ext {
artifactId = 'orkes-conductor-client'
artifactName = 'Orkes Conductor Client'
artifactDescription = 'Orkes Conductor client (http)'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public static ApiClientBuilder builder() {
public static class ApiClientBuilder extends Builder<ApiClientBuilder> {

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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 0f23965

Please sign in to comment.