diff --git a/sdk-actors/src/main/java/io/dapr/actors/client/ActorClient.java b/sdk-actors/src/main/java/io/dapr/actors/client/ActorClient.java index c69b60ff0..80d86d013 100644 --- a/sdk-actors/src/main/java/io/dapr/actors/client/ActorClient.java +++ b/sdk-actors/src/main/java/io/dapr/actors/client/ActorClient.java @@ -21,6 +21,8 @@ import io.grpc.Channel; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; /** @@ -28,6 +30,8 @@ */ public class ActorClient implements AutoCloseable { + private static final Logger LOGGER = LoggerFactory.getLogger(ActorClient.class); + /** * gRPC channel for communication with Dapr sidecar. */ @@ -118,7 +122,10 @@ private static ManagedChannel buildManagedChannel(DaprApiProtocol apiProtocol) { private static DaprClient buildDaprClient(DaprApiProtocol apiProtocol, Channel grpcManagedChannel) { switch (apiProtocol) { case GRPC: return new DaprGrpcClient(DaprGrpc.newStub(grpcManagedChannel)); - case HTTP: return new DaprHttpClient(new DaprHttpBuilder().build()); + case HTTP: { + LOGGER.warn("HTTP client protocol is deprecated and will be removed in Dapr's Java SDK version 1.10."); + return new DaprHttpClient(new DaprHttpBuilder().build()); + } default: throw new IllegalStateException("Unsupported protocol: " + apiProtocol.name()); } } diff --git a/sdk-actors/src/main/java/io/dapr/actors/client/DaprHttpClient.java b/sdk-actors/src/main/java/io/dapr/actors/client/DaprHttpClient.java index ab7316a79..eff62ae7e 100644 --- a/sdk-actors/src/main/java/io/dapr/actors/client/DaprHttpClient.java +++ b/sdk-actors/src/main/java/io/dapr/actors/client/DaprHttpClient.java @@ -18,9 +18,10 @@ /** * DaprClient over HTTP for actor client. - * + * @deprecated This class will be deleted at SDK release version 1.10. * @see DaprHttp */ +@Deprecated class DaprHttpClient implements DaprClient { /** diff --git a/sdk/src/main/java/io/dapr/client/DaprApiProtocol.java b/sdk/src/main/java/io/dapr/client/DaprApiProtocol.java index bea210942..a4d3fc3bf 100644 --- a/sdk/src/main/java/io/dapr/client/DaprApiProtocol.java +++ b/sdk/src/main/java/io/dapr/client/DaprApiProtocol.java @@ -15,7 +15,9 @@ /** * Transport protocol for Dapr's API. + * @deprecated This class will be deleted at SDK version 1.10. */ +@Deprecated public enum DaprApiProtocol { GRPC, diff --git a/sdk/src/main/java/io/dapr/client/DaprClientBuilder.java b/sdk/src/main/java/io/dapr/client/DaprClientBuilder.java index 7f3926c63..717e3309a 100644 --- a/sdk/src/main/java/io/dapr/client/DaprClientBuilder.java +++ b/sdk/src/main/java/io/dapr/client/DaprClientBuilder.java @@ -20,6 +20,8 @@ import io.dapr.v1.DaprGrpc; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.Closeable; @@ -29,6 +31,8 @@ */ public class DaprClientBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(DaprClientBuilder.class); + /** * Determine if this builder will create GRPC clients instead of HTTP clients. */ @@ -111,6 +115,10 @@ public DaprClientBuilder withStateSerializer(DaprObjectSerializer stateSerialize * @throws java.lang.IllegalStateException if any required field is missing */ public DaprClient build() { + if (this.apiProtocol == DaprApiProtocol.HTTP) { + LOGGER.warn("HTTP client protocol is deprecated and will be removed in Dapr's Java SDK version 1.10."); + } + if (this.apiProtocol != this.methodInvocationApiProtocol) { return new DaprClientProxy(buildDaprClient(this.apiProtocol), buildDaprClient(this.methodInvocationApiProtocol)); } diff --git a/sdk/src/main/java/io/dapr/client/DaprClientHttp.java b/sdk/src/main/java/io/dapr/client/DaprClientHttp.java index 85253c64c..2ec7bf780 100644 --- a/sdk/src/main/java/io/dapr/client/DaprClientHttp.java +++ b/sdk/src/main/java/io/dapr/client/DaprClientHttp.java @@ -66,10 +66,11 @@ /** * An adapter for the HTTP Client. - * + * @deprecated This class will be deleted at SDK release version 1.10. * @see io.dapr.client.DaprHttp * @see io.dapr.client.DaprClient */ +@Deprecated public class DaprClientHttp extends AbstractDaprClient { /** * Header for the conditional operation. diff --git a/sdk/src/main/java/io/dapr/client/DaprClientProxy.java b/sdk/src/main/java/io/dapr/client/DaprClientProxy.java index 32f1c5e8f..114ba132c 100644 --- a/sdk/src/main/java/io/dapr/client/DaprClientProxy.java +++ b/sdk/src/main/java/io/dapr/client/DaprClientProxy.java @@ -37,11 +37,12 @@ /** * Class that delegates to other implementations. - * + * @deprecated This class will be deleted at SDK release version 1.10. * @see DaprClient * @see DaprClientGrpc * @see DaprClientHttp */ +@Deprecated class DaprClientProxy implements DaprClient { /** diff --git a/sdk/src/main/java/io/dapr/client/DaprHttpBuilder.java b/sdk/src/main/java/io/dapr/client/DaprHttpBuilder.java index 94b8f0cda..3c4c34820 100644 --- a/sdk/src/main/java/io/dapr/client/DaprHttpBuilder.java +++ b/sdk/src/main/java/io/dapr/client/DaprHttpBuilder.java @@ -23,7 +23,9 @@ /** * A builder for the DaprHttp. + * @deprecated Use {@link DaprClientBuilder} instead, this will be removed in a future release. */ +@Deprecated public class DaprHttpBuilder { /** diff --git a/sdk/src/main/java/io/dapr/config/Properties.java b/sdk/src/main/java/io/dapr/config/Properties.java index fcd09d9b6..d0886f9d3 100644 --- a/sdk/src/main/java/io/dapr/config/Properties.java +++ b/sdk/src/main/java/io/dapr/config/Properties.java @@ -101,7 +101,9 @@ public class Properties { /** * Determines if Dapr client will use gRPC or HTTP to talk to Dapr's side car. + * @deprecated This attribute will be deleted at SDK version 1.10. */ + @Deprecated public static final Property API_PROTOCOL = new GenericProperty<>( "dapr.api.protocol", "DAPR_API_PROTOCOL", @@ -110,7 +112,9 @@ public class Properties { /** * Determines if Dapr client should use gRPC or HTTP for Dapr's service method invocation APIs. + * @deprecated This attribute will be deleted at SDK version 1.10. */ + @Deprecated public static final Property API_METHOD_INVOCATION_PROTOCOL = new GenericProperty<>( "dapr.api.methodInvocation.protocol", "DAPR_API_METHOD_INVOCATION_PROTOCOL",