From 022c0eefd1d140f194c3c3e6057f633b93edef65 Mon Sep 17 00:00:00 2001 From: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com> Date: Tue, 9 May 2023 23:16:54 +0530 Subject: [PATCH] Convert Config API to Stable endpoints. (#846) Signed-off-by: Mahmut Canga --- .github/workflows/build.yml | 4 +- .github/workflows/validate.yml | 4 +- .../grpc/ConfigurationClient.java | 9 +- .../examples/configuration/grpc/README.md | 7 +- .../http/ConfigurationClient.java | 9 +- .../examples/configuration/http/README.md | 6 +- pom.xml | 4 +- sdk-tests/pom.xml | 2 +- .../grpc/ConfigurationClientIT.java | 18 +- .../configuration/http/ConfigurationIT.java | 12 +- .../http/ConfigurationSubscribeIT.java | 12 +- .../main/java/io/dapr/client/DaprClient.java | 100 +++++++ .../java/io/dapr/client/DaprClientGrpc.java | 10 +- .../java/io/dapr/client/DaprClientHttp.java | 6 +- .../java/io/dapr/client/DaprClientProxy.java | 91 ++++++- .../io/dapr/client/DaprPreviewClient.java | 100 ------- .../io/dapr/client/DaprClientGrpcTest.java | 249 +++++++++++++++++ .../io/dapr/client/DaprClientHttpTest.java | 122 +++++++++ .../client/DaprPreviewClientGrpcTest.java | 252 ------------------ .../client/DaprPreviewClientHttpTest.java | 123 --------- 20 files changed, 612 insertions(+), 528 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08dde02e0..8a17bda50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: spring-boot-version: 2.3.6.RELEASE experimental: false env: - GOVER: 1.19 + GOVER: "1.20" GOOS: linux GOARCH: amd64 GOPROXY: https://proxy.golang.org @@ -47,7 +47,7 @@ jobs: DAPR_RUNTIME_VER: 1.10.6-rc.2 DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.10.0/install/install.sh DAPR_CLI_REF: - DAPR_REF: + DAPR_REF: 1415e23b14628db70adf9403f5a18876f40b6924 steps: - uses: actions/checkout@v3 - name: Set up OpenJDK ${{ env.JDK_VER }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 951aa644c..038c2db0b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -32,7 +32,7 @@ jobs: matrix: java: [ 11, 13, 15, 16 ] env: - GOVER: 1.19 + GOVER: "1.20" GOOS: linux GOARCH: amd64 GOPROXY: https://proxy.golang.org @@ -41,7 +41,7 @@ jobs: DAPR_RUNTIME_VER: 1.10.6-rc.2 DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.10.0/install/install.sh DAPR_CLI_REF: - DAPR_REF: + DAPR_REF: 1415e23b14628db70adf9403f5a18876f40b6924 steps: - uses: actions/checkout@v3 - name: Set up OpenJDK ${{ env.JDK_VER }} diff --git a/examples/src/main/java/io/dapr/examples/configuration/grpc/ConfigurationClient.java b/examples/src/main/java/io/dapr/examples/configuration/grpc/ConfigurationClient.java index 69e36b5f2..14648e030 100644 --- a/examples/src/main/java/io/dapr/examples/configuration/grpc/ConfigurationClient.java +++ b/examples/src/main/java/io/dapr/examples/configuration/grpc/ConfigurationClient.java @@ -13,6 +13,7 @@ package io.dapr.examples.configuration.grpc; +import io.dapr.client.DaprClient; import io.dapr.client.DaprClientBuilder; import io.dapr.client.DaprPreviewClient; import io.dapr.client.domain.ConfigurationItem; @@ -44,8 +45,8 @@ public class ConfigurationClient { * @throws Exception throws Exception */ public static void main(String[] args) throws Exception { - try (DaprPreviewClient client = (new DaprClientBuilder()).buildPreviewClient()) { - System.out.println("Using preview client..."); + try (DaprClient client = (new DaprClientBuilder()).build()) { + System.out.println("Using Dapr client..."); getConfigurations(client); subscribeConfigurationRequest(client); } @@ -56,7 +57,7 @@ public static void main(String[] args) throws Exception { * * @param client DaprPreviewClient object */ - public static void getConfigurations(DaprPreviewClient client) { + public static void getConfigurations(DaprClient client) { System.out.println("*******trying to retrieve configurations for a list of keys********"); List keys = new ArrayList<>(); keys.add("myconfig1"); @@ -76,7 +77,7 @@ public static void getConfigurations(DaprPreviewClient client) { * * @param client DaprPreviewClient object */ - public static void subscribeConfigurationRequest(DaprPreviewClient client) { + public static void subscribeConfigurationRequest(DaprClient client) { System.out.println("Subscribing to key: myconfig1"); SubscribeConfigurationRequest req = new SubscribeConfigurationRequest( CONFIG_STORE_NAME, Collections.singletonList("myconfig1")); diff --git a/examples/src/main/java/io/dapr/examples/configuration/grpc/README.md b/examples/src/main/java/io/dapr/examples/configuration/grpc/README.md index 832f65871..e30d8c887 100644 --- a/examples/src/main/java/io/dapr/examples/configuration/grpc/README.md +++ b/examples/src/main/java/io/dapr/examples/configuration/grpc/README.md @@ -1,7 +1,6 @@ ## Retrieve Configurations via Configuration API This example provides the different capabilities provided by Dapr Java SDK for Configuration. For further information about Configuration APIs please refer to [this link](https://docs.dapr.io/developing-applications/building-blocks/configuration/) -**This API is available in Preview Mode**. ### Using the ConfigurationAPI @@ -63,7 +62,7 @@ public class ConfigurationClient { */ public static void main(String[] args) throws Exception { try (DaprPreviewClient client = (new DaprClientBuilder()).buildPreviewClient()) { - System.out.println("Using preview client..."); + System.out.println("Using Dapr client..."); getConfigurations(client); subscribeConfigurationRequestWithSubscribe(client); unsubscribeConfigurationItems(client); @@ -134,7 +133,7 @@ Use the following command to run this example-