diff --git a/.github/workflows/build-validation.yml b/.github/workflows/build-validation.yml index 8fd6d57c..9aad2d10 100644 --- a/.github/workflows/build-validation.yml +++ b/.github/workflows/build-validation.yml @@ -8,6 +8,7 @@ name: Build Validation on: + workflow_dispatch: push: branches: [ main ] pull_request: diff --git a/CHANGELOG.md b/CHANGELOG.md index d81ab680..052ef112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## Unreleased +## v1.6.3 +* Add DurableTaskGrpcClientFactory ([#256](https://github.com/microsoft/durabletask-java/pull/256)) +* Add support for running GitHub workflows manually and update flaky tests ([#258](https://github.com/microsoft/durabletask-java/pull/258)) + +## v1.6.2 +* Fixing gRPC channel shutdown ([#249](https://github.com/microsoft/durabletask-java/pull/249)) + ## v1.6.1 * Add support for default versions in Durable Function sub-orchestrations ([#241](https://github.com/microsoft/durabletask-java/pull/241)) diff --git a/azurefunctions/build.gradle b/azurefunctions/build.gradle index ab43e553..e82a5e7c 100644 --- a/azurefunctions/build.gradle +++ b/azurefunctions/build.gradle @@ -6,7 +6,7 @@ plugins { } group 'com.microsoft' -version = '1.6.1' +version = '1.6.3' archivesBaseName = 'durabletask-azure-functions' def protocVersion = '3.12.0' diff --git a/azurefunctions/src/main/java/com/microsoft/durabletask/azurefunctions/DurableClientContext.java b/azurefunctions/src/main/java/com/microsoft/durabletask/azurefunctions/DurableClientContext.java index a952db68..bbf5e198 100644 --- a/azurefunctions/src/main/java/com/microsoft/durabletask/azurefunctions/DurableClientContext.java +++ b/azurefunctions/src/main/java/com/microsoft/durabletask/azurefunctions/DurableClientContext.java @@ -8,7 +8,7 @@ import com.microsoft.azure.functions.HttpStatus; import com.microsoft.durabletask.DurableTaskClient; -import com.microsoft.durabletask.DurableTaskGrpcClientBuilder; +import com.microsoft.durabletask.DurableTaskGrpcClientFactory; import com.microsoft.durabletask.OrchestrationMetadata; import com.microsoft.durabletask.OrchestrationRuntimeStatus; @@ -45,6 +45,10 @@ public String getTaskHubName() { * @return the Durable Task client object associated with the current function invocation. */ public DurableTaskClient getClient() { + if (this.client != null) { + return this.client; + } + if (this.rpcBaseUrl == null || this.rpcBaseUrl.length() == 0) { throw new IllegalStateException("The client context wasn't populated with an RPC base URL!"); } @@ -56,7 +60,7 @@ public DurableTaskClient getClient() { throw new IllegalStateException("The client context RPC base URL was invalid!", ex); } - this.client = new DurableTaskGrpcClientBuilder().port(rpcURL.getPort()).build(); + this.client = DurableTaskGrpcClientFactory.getClient(rpcURL.getPort(), null); return this.client; } @@ -78,9 +82,7 @@ public HttpResponseMessage waitForCompletionOrCreateCheckStatusResponse( HttpRequestMessage> request, String instanceId, Duration timeout) { - if (this.client == null) { - this.client = getClient(); - } + this.client = getClient(); OrchestrationMetadata orchestration; try { orchestration = this.client.waitForInstanceCompletion(instanceId, timeout, true); diff --git a/azuremanaged/build.gradle b/azuremanaged/build.gradle index 1839bd59..53f986da 100644 --- a/azuremanaged/build.gradle +++ b/azuremanaged/build.gradle @@ -17,7 +17,7 @@ plugins { archivesBaseName = 'durabletask-azuremanaged' group 'com.microsoft' -version = '1.6.1-preview.1' +version = '1.6.3' def grpcVersion = '1.59.0' def azureCoreVersion = '1.45.0' diff --git a/client/build.gradle b/client/build.gradle index 3d3769f2..a39d855a 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -10,7 +10,7 @@ plugins { } group 'com.microsoft' -version = '1.6.1' +version = '1.6.3' archivesBaseName = 'durabletask-client' def grpcVersion = '1.59.0' diff --git a/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java b/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java index 52d072b8..2ebb6ec8 100644 --- a/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java +++ b/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java @@ -61,6 +61,18 @@ public final class DurableTaskGrpcClient extends DurableTaskClient { this.sidecarClient = TaskHubSidecarServiceGrpc.newBlockingStub(sidecarGrpcChannel); } + DurableTaskGrpcClient(int port, String defaultVersion) { + this.dataConverter = new JacksonDataConverter(); + this.defaultVersion = defaultVersion; + + // Need to keep track of this channel so we can dispose it on close() + this.managedSidecarChannel = ManagedChannelBuilder + .forAddress("localhost", port) + .usePlaintext() + .build(); + this.sidecarClient = TaskHubSidecarServiceGrpc.newBlockingStub(this.managedSidecarChannel); + } + /** * Closes the internally managed gRPC channel, if one exists. *
diff --git a/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClientFactory.java b/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClientFactory.java
new file mode 100644
index 00000000..f22a4ba7
--- /dev/null
+++ b/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClientFactory.java
@@ -0,0 +1,19 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.microsoft.durabletask;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+public final class DurableTaskGrpcClientFactory {
+ private static final ConcurrentMap