This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-connectors.git
The following commit(s) were added to refs/heads/main by this push:
new a06736cd3 refactor: remove Alpakka 3.0.0 deprecated APIs
(PubSubSettings, Credentials.cache) (#1748)
a06736cd3 is described below
commit a06736cd3f6237a691f479fe354d7232c5fc5ca7
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Jul 5 16:39:48 2026 +0800
refactor: remove Alpakka 3.0.0 deprecated APIs (PubSubSettings,
Credentials.cache) (#1748)
Motivation:
PubSubSettings.callCredentials and Credentials.cache were deprecated since
Alpakka 3.0.0 in favor of GoogleSettings-based credential management.
Modification:
Remove PubSubSettings.callCredentials field and withCallCredentials method.
Delete DeprecatedCredentials marker class. Refactor PekkoGrpcSettings to
resolve credentials via GoogleSettings directly, using NoCredentials for
emulator mode. Remove Credentials.cache and _cache field. Update
reference.conf
and test configs. Update docs.
Add MiMa filters for the removed methods.
Result:
Cleaner API with GoogleSettings as the single source for credential
configuration.
Tests:
Not run - deprecated API cleanup with equivalent behavior
References:
None - deprecated API cleanup
---
.../main/paradox/google-cloud-bigquery-storage.md | 3 +-
google-cloud-pub-sub-grpc/README.md | 1 -
.../remove-deprecated-callCredentials.excludes | 24 +++++++++++
.../src/main/resources/reference.conf | 3 --
.../googlecloud/pubsub/grpc/PubSubSettings.scala | 39 ++++-------------
.../pubsub/grpc/impl/DeprecatedCredentials.scala | 49 ----------------------
.../pubsub/grpc/impl/PekkoGrpcSettings.scala | 12 +++---
.../src/test/resources/application.conf | 3 +-
.../remove-deprecated-credentials-cache.excludes | 19 +++++++++
.../connectors/google/auth/Credentials.scala | 11 -----
10 files changed, 59 insertions(+), 105 deletions(-)
diff --git a/docs/src/main/paradox/google-cloud-bigquery-storage.md
b/docs/src/main/paradox/google-cloud-bigquery-storage.md
index 8cdc034ed..cc7d168f8 100644
--- a/docs/src/main/paradox/google-cloud-bigquery-storage.md
+++ b/docs/src/main/paradox/google-cloud-bigquery-storage.md
@@ -55,8 +55,9 @@ pekko.connectors.google.cloud.bigquery.grpc {
host = "localhost"
port = 21000
rootCa = "none"
- callCredentials = "none"
}
+
+pekko.connectors.google.credentials.provider = none
```
For more configuration details consider the underlying configuration for
@extref:[Apache Pekko gRPC](pekko-grpc:/client/configuration.html).
diff --git a/google-cloud-pub-sub-grpc/README.md
b/google-cloud-pub-sub-grpc/README.md
index c3cdf4c15..08b70fd17 100644
--- a/google-cloud-pub-sub-grpc/README.md
+++ b/google-cloud-pub-sub-grpc/README.md
@@ -47,7 +47,6 @@ pekko.connectors.google.cloud.pubsub.grpc {
# host = "localhost"
# port = 8538
# use-tls = false
- # callCredentials = "none"
}
pekko.connectors.google {
diff --git
a/google-cloud-pub-sub-grpc/src/main/mima-filters/1.2.0.backwards.excludes/remove-deprecated-callCredentials.excludes
b/google-cloud-pub-sub-grpc/src/main/mima-filters/1.2.0.backwards.excludes/remove-deprecated-callCredentials.excludes
new file mode 100644
index 000000000..15454955c
--- /dev/null
+++
b/google-cloud-pub-sub-grpc/src/main/mima-filters/1.2.0.backwards.excludes/remove-deprecated-callCredentials.excludes
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Remove deprecated PubSubSettings.callCredentials (since Alpakka 3.0.0)
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.PubSubSettings.callCredentials")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.PubSubSettings.withCallCredentials")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.PubSubSettings.this")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.PubSubSettings.copy$default$5")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.impl.DeprecatedCredentials")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.impl.DeprecatedCredentials$")
diff --git a/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
b/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
index 604960db4..1cc158e46 100644
--- a/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
+++ b/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
@@ -10,7 +10,4 @@ pekko.connectors.google.cloud.pubsub.grpc {
# Set to "none" to use the system default CA
rootCa = "none"
-
- # Deprecated, use config path pekko.connectors.google.credentials.provider
- callCredentials = deprecated
}
diff --git
a/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/PubSubSettings.scala
b/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/PubSubSettings.scala
index 42c50b168..4f535f189 100644
---
a/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/PubSubSettings.scala
+++
b/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/PubSubSettings.scala
@@ -15,11 +15,7 @@ package
org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc
import org.apache.pekko
import pekko.actor.ClassicActorSystemProvider
-import
pekko.stream.connectors.googlecloud.pubsub.grpc.impl.DeprecatedCredentials
import com.typesafe.config.Config
-import io.grpc.CallCredentials
-
-import scala.annotation.nowarn
/**
* Connection settings used to establish Pub/Sub connection.
@@ -28,12 +24,7 @@ final class PubSubSettings private (
val host: String,
val port: Int,
val useTls: Boolean,
- val rootCa: Option[String],
- /** @deprecated Use [[pekko.stream.connectors.google.GoogleSettings]] */
- @deprecated(
- "Use org.apache.pekko.stream.connectors.google.GoogleSettings",
- "Alpakka 3.0.0") @Deprecated(since = "Alpakka 3.0.0") val
callCredentials: Option[
- CallCredentials]) {
+ val rootCa: Option[String]) {
/**
* Endpoint hostname where the gRPC connection is made.
@@ -52,31 +43,20 @@ final class PubSubSettings private (
def withRootCa(rootCa: String): PubSubSettings =
copy(rootCa = Some(rootCa))
- /**
- * Credentials that are going to be used for gRPC call authorization.
- * @deprecated Use [[pekko.stream.connectors.google.GoogleSettings]]
- */
- @deprecated("Use org.apache.pekko.stream.connectors.google.GoogleSettings",
"Alpakka 3.0.0")
- @Deprecated
- def withCallCredentials(callCredentials: CallCredentials): PubSubSettings =
- copy(callCredentials = Some(callCredentials))
-
private def copy(host: String = host,
port: Int = port,
useTls: Boolean = useTls,
- rootCa: Option[String] = rootCa,
- callCredentials: Option[CallCredentials] = callCredentials:
@nowarn("msg=deprecated")) =
- new PubSubSettings(host, port, useTls, rootCa, callCredentials)
+ rootCa: Option[String] = rootCa) =
+ new PubSubSettings(host, port, useTls, rootCa)
}
object PubSubSettings {
/**
- * Create settings for unsecure (no tls), unauthenticated (no root ca)
- * and unauthorized (no call credentials) endpoint.
+ * Create settings for unsecure (no tls), unauthenticated (no root ca)
endpoint.
*/
def apply(host: String, port: Int): PubSubSettings =
- new PubSubSettings(host, port, false, None, None)
+ new PubSubSettings(host, port, false, None)
/**
* Create settings from config instance.
@@ -86,11 +66,7 @@ object PubSubSettings {
config.getString("host"),
config.getInt("port"),
config.getBoolean("use-tls"),
- Some(config.getString("rootCa")).filter(_ != "none"),
- config.getString("callCredentials") match {
- case "none" => None
- case _ => Some(DeprecatedCredentials.marker)
- })
+ Some(config.getString("rootCa")).filter(_ != "none"))
/**
* Create settings from the new actor API's ActorSystem config.
@@ -106,8 +82,7 @@ object PubSubSettings {
/**
* Java API
*
- * Create settings for unsecure (no tls), unauthenticated (no root ca)
- * and unauthorized (no call credentials) endpoint.
+ * Create settings for unsecure (no tls), unauthenticated (no root ca)
endpoint.
*/
def create(host: String, port: Int): PubSubSettings =
PubSubSettings(host, port)
diff --git
a/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/DeprecatedCredentials.scala
b/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/DeprecatedCredentials.scala
deleted file mode 100644
index e1667971c..000000000
---
a/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/DeprecatedCredentials.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) since 2016 Lightbend Inc. <https://www.lightbend.com>
- */
-
-package org.apache.pekko.stream.connectors.googlecloud.pubsub.grpc.impl
-
-import org.apache.pekko.annotation.InternalApi
-import io.grpc.{ CallCredentials, Metadata }
-
-import java.util.concurrent.Executor
-import scala.annotation.nowarn
-
-/**
- * Marker class indicating that credentials should be resolved via
GoogleSettings.
- */
-@InternalApi
-private[grpc] final case class DeprecatedCredentials(underlying:
CallCredentials) extends CallCredentials {
-
- override def applyRequestMetadata(requestInfo: CallCredentials.RequestInfo,
- appExecutor: Executor,
- applier: CallCredentials.MetadataApplier): Unit =
- underlying.applyRequestMetadata(requestInfo, appExecutor, applier)
-
- @nowarn("msg=is deprecated")
- override def thisUsesUnstableApi(): Unit = underlying.thisUsesUnstableApi()
-}
-
-@InternalApi
-private[grpc] object DeprecatedCredentials {
-
- /** A no-op marker instance used to signal "resolve via GoogleSettings". */
- val marker: CallCredentials = DeprecatedCredentials(new CallCredentials {
- override def applyRequestMetadata(requestInfo: CallCredentials.RequestInfo,
- appExecutor: Executor,
- applier: CallCredentials.MetadataApplier): Unit =
- applier.apply(new Metadata())
-
- override def thisUsesUnstableApi(): Unit = ()
- })
-}
diff --git
a/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/PekkoGrpcSettings.scala
b/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/PekkoGrpcSettings.scala
index 30c5be98d..f045b311a 100644
---
a/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/PekkoGrpcSettings.scala
+++
b/google-cloud-pub-sub-grpc/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/pubsub/grpc/impl/PekkoGrpcSettings.scala
@@ -18,12 +18,11 @@ import pekko.actor.ActorSystem
import pekko.annotation.InternalApi
import pekko.grpc.GrpcClientSettings
import pekko.stream.connectors.google.GoogleSettings
+import pekko.stream.connectors.google.auth.{ Credentials, NoCredentials }
import pekko.stream.connectors.googlecloud.pubsub.grpc.PubSubSettings
import com.typesafe.config.ConfigFactory
import io.grpc.auth.MoreCallCredentials
-import scala.annotation.nowarn
-
/**
* Internal API
*/
@@ -42,12 +41,11 @@ import scala.annotation.nowarn
.parseString(pekkoGrpcConfig)
.withFallback(sys.settings.config.getConfig("pekko.grpc.client.\"*\"")))
- (config.callCredentials: @nowarn("msg=deprecated")) match {
- case None => settings // explicit opt-out
(callCredentials = "none"), e.g. emulator
- case Some(_: DeprecatedCredentials) => // default: resolve via
GoogleSettings
- val credentials = googleSettings.credentials.asGoogle(sys.dispatcher,
googleSettings.requestSettings)
+ googleSettings.credentials match {
+ case _: NoCredentials => settings // no credentials (e.g. emulator)
+ case creds: Credentials =>
+ val credentials = creds.asGoogle(sys.dispatcher,
googleSettings.requestSettings)
settings.withCallCredentials(MoreCallCredentials.from(credentials))
- case Some(creds) => settings.withCallCredentials(creds)
}
}
}
diff --git a/google-cloud-pub-sub-grpc/src/test/resources/application.conf
b/google-cloud-pub-sub-grpc/src/test/resources/application.conf
index 135619523..74331c186 100644
--- a/google-cloud-pub-sub-grpc/src/test/resources/application.conf
+++ b/google-cloud-pub-sub-grpc/src/test/resources/application.conf
@@ -21,5 +21,6 @@ pekko.connectors.google.cloud.pubsub.grpc {
port = 8538
use-tls = false # no TLS
rootCa = "none"
- callCredentials = "none" # no authentication
}
+
+pekko.connectors.google.credentials.provider = none
diff --git
a/google-common/src/main/mima-filters/1.2.0.backwards.excludes/remove-deprecated-credentials-cache.excludes
b/google-common/src/main/mima-filters/1.2.0.backwards.excludes/remove-deprecated-credentials-cache.excludes
new file mode 100644
index 000000000..9474abdd0
--- /dev/null
+++
b/google-common/src/main/mima-filters/1.2.0.backwards.excludes/remove-deprecated-credentials-cache.excludes
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Remove deprecated Credentials.cache (since Alpakka 3.0.0)
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.stream.connectors.google.auth.Credentials.cache")
diff --git
a/google-common/src/main/scala/org/apache/pekko/stream/connectors/google/auth/Credentials.scala
b/google-common/src/main/scala/org/apache/pekko/stream/connectors/google/auth/Credentials.scala
index 3027cf526..83a843404 100644
---
a/google-common/src/main/scala/org/apache/pekko/stream/connectors/google/auth/Credentials.scala
+++
b/google-common/src/main/scala/org/apache/pekko/stream/connectors/google/auth/Credentials.scala
@@ -24,7 +24,6 @@ import com.typesafe.config.Config
import java.util.concurrent.Executor
-import scala.collection.immutable.ListMap
import scala.concurrent.{ Await, ExecutionContext, Future }
import scala.jdk.CollectionConverters._
import scala.jdk.DurationConverters._
@@ -103,16 +102,6 @@ object Credentials {
private def parseAccessToken(c: Config) =
AccessTokenCredentials(c.getConfig("access-token"))
private def parseNone(c: Config) = NoCredentials(c.getConfig("none"))
-
- private var _cache: Map[Any, Credentials] = ListMap.empty
- @deprecated("Intended only to help with migration", "Alpakka 3.0.0")
- private[connectors] def cache(key: Any)(default: => Credentials) =
- _cache.getOrElse(key, {
- val credentials = default
- _cache += (key -> credentials)
- credentials
- })
-
}
@DoNotInherit
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]