This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-projection.git
The following commit(s) were added to refs/heads/main by this push:
new 9e7bb2a some more scala converter changes (#306)
9e7bb2a is described below
commit 9e7bb2a3964be591ae26870262208878bb0e1d1b
Author: PJ Fanning <[email protected]>
AuthorDate: Sat Sep 27 14:18:39 2025 +0100
some more scala converter changes (#306)
* some more scala converter changes
* scalafmt
---
.../org/apache/pekko/projection/HandlerRecoveryStrategy.scala | 6 +++---
.../apache/pekko/projection/internal/ProjectionSettings.scala | 11 ++++++-----
.../pekko/projection/scaladsl/ProjectionManagement.scala | 6 +++---
.../pekko/projection/testkit/javadsl/ProjectionTestKit.scala | 7 ++++---
.../pekko/projection/testkit/javadsl/TestSourceProvider.scala | 3 ++-
5 files changed, 18 insertions(+), 15 deletions(-)
diff --git
a/core/src/main/scala/org/apache/pekko/projection/HandlerRecoveryStrategy.scala
b/core/src/main/scala/org/apache/pekko/projection/HandlerRecoveryStrategy.scala
index 05e6ad5..435a320 100644
---
a/core/src/main/scala/org/apache/pekko/projection/HandlerRecoveryStrategy.scala
+++
b/core/src/main/scala/org/apache/pekko/projection/HandlerRecoveryStrategy.scala
@@ -14,11 +14,11 @@
package org.apache.pekko.projection
import scala.concurrent.duration.FiniteDuration
+import scala.jdk.DurationConverters._
import org.apache.pekko
import pekko.annotation.ApiMayChange
import pekko.annotation.InternalApi
-import pekko.util.JavaDurationConverters._
/**
* Error handling strategy when processing an `Envelope` fails. The default is
defined in configuration .
@@ -58,7 +58,7 @@ object HandlerRecoveryStrategy {
* and fail the stream if all attempts fail.
*/
def retryAndFail(retries: Int, delay: java.time.Duration):
HandlerRecoveryStrategy =
- retryAndFail(retries, delay.asScala)
+ retryAndFail(retries, delay.toScala)
/**
* Scala API: If the first attempt to invoke the handler fails it will retry
invoking the handler with the
@@ -74,7 +74,7 @@ object HandlerRecoveryStrategy {
* discard the element and continue with next if all attempts fail.
*/
def retryAndSkip(retries: Int, delay: java.time.Duration):
HandlerRecoveryStrategy =
- retryAndSkip(retries, delay.asScala)
+ retryAndSkip(retries, delay.toScala)
/**
* INTERNAL API: placed here instead of the `internal` package because of
sealed trait
diff --git
a/core/src/main/scala/org/apache/pekko/projection/internal/ProjectionSettings.scala
b/core/src/main/scala/org/apache/pekko/projection/internal/ProjectionSettings.scala
index e3e5b12..c94c2c8 100644
---
a/core/src/main/scala/org/apache/pekko/projection/internal/ProjectionSettings.scala
+++
b/core/src/main/scala/org/apache/pekko/projection/internal/ProjectionSettings.scala
@@ -15,6 +15,7 @@ package org.apache.pekko.projection.internal
import scala.concurrent.duration.FiniteDuration
import scala.concurrent.duration._
+import scala.jdk.DurationConverters._
import org.apache.pekko
import pekko.actor.typed.ActorSystem
@@ -22,7 +23,6 @@ import pekko.annotation.InternalApi
import pekko.projection.HandlerRecoveryStrategy
import pekko.projection.Projection
import pekko.stream.RestartSettings
-import pekko.util.JavaDurationConverters._
import com.typesafe.config.Config
/**
@@ -112,7 +112,7 @@ private object RecoveryStrategyConfig {
minBackoff: java.time.Duration,
maxBackoff: java.time.Duration,
randomFactor: Double): ProjectionImpl =
- withRestartBackoffSettings(RestartSettings(minBackoff.asScala,
maxBackoff.asScala, randomFactor))
+ withRestartBackoffSettings(RestartSettings(minBackoff.toScala,
maxBackoff.toScala, randomFactor))
def withRestartBackoff(
minBackoff: java.time.Duration,
@@ -120,16 +120,17 @@ private object RecoveryStrategyConfig {
randomFactor: Double,
maxRestarts: Int): ProjectionImpl =
withRestartBackoffSettings(
- RestartSettings(minBackoff.asScala, maxBackoff.asScala,
randomFactor).withMaxRestarts(maxRestarts, minBackoff))
+ RestartSettings(minBackoff.toScala, maxBackoff.toScala,
randomFactor).withMaxRestarts(maxRestarts,
+ minBackoff.toScala))
def withSaveOffset(afterEnvelopes: Int, afterDuration: FiniteDuration):
ProjectionImpl
def withSaveOffset(afterEnvelopes: Int, afterDuration: java.time.Duration):
ProjectionImpl =
- withSaveOffset(afterEnvelopes, afterDuration.asScala)
+ withSaveOffset(afterEnvelopes, afterDuration.toScala)
def withGroup(groupAfterEnvelopes: Int, groupAfterDuration: FiniteDuration):
ProjectionImpl
def withGroup(groupAfterEnvelopes: Int, groupAfterDuration:
java.time.Duration): ProjectionImpl =
- withGroup(groupAfterEnvelopes, groupAfterDuration.asScala)
+ withGroup(groupAfterEnvelopes, groupAfterDuration.toScala)
}
diff --git
a/core/src/main/scala/org/apache/pekko/projection/scaladsl/ProjectionManagement.scala
b/core/src/main/scala/org/apache/pekko/projection/scaladsl/ProjectionManagement.scala
index 7fa459d..36aa3a7 100644
---
a/core/src/main/scala/org/apache/pekko/projection/scaladsl/ProjectionManagement.scala
+++
b/core/src/main/scala/org/apache/pekko/projection/scaladsl/ProjectionManagement.scala
@@ -19,6 +19,7 @@ import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.TimeoutException
import scala.concurrent.duration.FiniteDuration
+import scala.jdk.DurationConverters._
import org.apache.pekko
import pekko.Done
@@ -31,7 +32,6 @@ import pekko.actor.typed.scaladsl.AskPattern._
import pekko.annotation.ApiMayChange
import pekko.projection.ProjectionBehavior
import pekko.projection.ProjectionId
-import pekko.util.JavaDurationConverters._
import pekko.util.Timeout
@ApiMayChange object ProjectionManagement extends
ExtensionId[ProjectionManagement] {
@@ -43,10 +43,10 @@ import pekko.util.Timeout
@ApiMayChange class ProjectionManagement(system: ActorSystem[_]) extends
Extension {
private implicit val sys: ActorSystem[_] = system
private implicit val askTimeout: Timeout = {
-
system.settings.config.getDuration("pekko.projection.management.ask-timeout").asScala
+
system.settings.config.getDuration("pekko.projection.management.ask-timeout").toScala
}
private val operationTimeout: FiniteDuration =
-
system.settings.config.getDuration("pekko.projection.management.operation-timeout").asScala
+
system.settings.config.getDuration("pekko.projection.management.operation-timeout").toScala
private val retryAttempts: Int = math.max(1, (operationTimeout /
askTimeout.duration).toInt)
private implicit val ec: ExecutionContext = system.executionContext
diff --git
a/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/ProjectionTestKit.scala
b/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/ProjectionTestKit.scala
index 6eaaece..190b235 100644
---
a/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/ProjectionTestKit.scala
+++
b/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/ProjectionTestKit.scala
@@ -24,7 +24,8 @@ import pekko.japi.function.Procedure
import pekko.projection.Projection
import pekko.projection.testkit.scaladsl
import pekko.stream.testkit.TestSubscriber
-import pekko.util.JavaDurationConverters._
+
+import scala.jdk.DurationConverters._
@ApiMayChange
object ProjectionTestKit {
@@ -69,7 +70,7 @@ final class ProjectionTestKit private[projection] (system:
ActorSystem[_]) {
* @param assertFunction - a function that exercises the test assertions
*/
def run(projection: Projection[_], max: Duration, assertFunction: Effect):
Unit =
- delegate.run(projection, max.asScala)(assertFunction.apply())
+ delegate.run(projection, max.toScala)(assertFunction.apply())
/**
* Run a Projection and assert its projected data using the passed assert
function,
@@ -89,7 +90,7 @@ final class ProjectionTestKit private[projection] (system:
ActorSystem[_]) {
* @param assertFunction - a function that exercises the test assertions
*/
def run(projection: Projection[_], max: Duration, interval: Duration,
assertFunction: Effect): Unit =
- delegate.run(projection, max.asScala,
interval.asScala)(assertFunction.apply())
+ delegate.run(projection, max.toScala,
interval.toScala)(assertFunction.apply())
/**
* Run a Projection with an attached `TestSubscriber.Probe` allowing
diff --git
a/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/TestSourceProvider.scala
b/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/TestSourceProvider.scala
index 4d36ebc..1358d03 100644
---
a/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/TestSourceProvider.scala
+++
b/testkit/src/main/scala/org/apache/pekko/projection/testkit/javadsl/TestSourceProvider.scala
@@ -19,7 +19,8 @@ import pekko.annotation.ApiMayChange
import pekko.projection.OffsetVerification
import pekko.projection.javadsl.VerifiableSourceProvider
import pekko.projection.testkit.internal.TestSourceProviderImpl
-import pekko.util.FunctionConverters._
+
+import scala.jdk.FunctionConverters._
@ApiMayChange
object TestSourceProvider {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]