Skip to content

Commit a43bbde

Browse files
Migrate away from Akka to Apache Pekko (#26)
1 parent c2b9c8f commit a43bbde

9 files changed

+31
-33
lines changed

build.sbt

+4-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ lazy val compileSettings = Seq(
2929
// Ensure Java-based DAS SDK code is compiled first, so it is accessible from Scala.
3030
compileOrder := CompileOrder.JavaThenScala,
3131
// Ensure we fork new JVM for run, so we can set JVM flags.
32-
Compile / run / fork := true
33-
)
32+
Compile / run / fork := true)
3433

3534
lazy val testSettings = Seq(
3635
// Ensure we fork new JVM for run, so we can set JVM flags.
@@ -74,11 +73,9 @@ lazy val root = (project in file("."))
7473
// Protocol DAS
7574
"com.raw-labs" %% "protocol-das" % "1.0.0",
7675
// Akka Streams
77-
"com.typesafe.akka" %% "akka-actor-typed" % "2.8.8",
78-
"com.typesafe.akka" %% "akka-actor" % "2.8.8",
79-
"com.typesafe.akka" %% "akka-stream" % "2.8.8",
80-
"com.typesafe.akka" %% "akka-actor-testkit-typed" % "2.8.8",
81-
"com.typesafe.akka" %% "akka-testkit" % "2.8.8",
76+
"org.apache.pekko" %% "pekko-actor-typed" % "1.1.3",
77+
"org.apache.pekko" %% "pekko-stream" % "1.1.3",
78+
"org.apache.pekko" %% "pekko-http" % "1.1.0",
8279
// Jackson databind
8380
"com.fasterxml.jackson.core" % "jackson-databind" % "2.18.2" % Test,
8481
// gRPC Testing

src/main/resources/reference.conf

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
akka.license-key=${?AKKA_LICENSE_KEY}
2-
31
das {
42
server {
53
port = 50051 # the port the server listens on

src/main/scala/com/rawlabs/das/server/DASServer.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ package com.rawlabs.das.server
1515
import scala.concurrent.ExecutionContext
1616
import scala.jdk.DurationConverters.JavaDurationOps
1717

18+
import org.apache.pekko.actor.typed.scaladsl.Behaviors
19+
import org.apache.pekko.actor.typed.{ActorSystem, Scheduler}
20+
import org.apache.pekko.stream.Materializer
21+
1822
import com.rawlabs.das.sdk.DASSettings
1923
import com.rawlabs.das.server.cache.QueryResultCache
2024
import com.rawlabs.das.server.grpc.{
@@ -27,9 +31,6 @@ import com.rawlabs.das.server.manager.DASSdkManager
2731
import com.rawlabs.das.server.webui.{DASWebUIServer, DebugAppService}
2832
import com.rawlabs.protocol.das.v1.services.{HealthCheckServiceGrpc, RegistrationServiceGrpc, TablesServiceGrpc}
2933

30-
import akka.actor.typed.scaladsl.Behaviors
31-
import akka.actor.typed.{ActorSystem, Scheduler}
32-
import akka.stream.Materializer
3334
import io.grpc.{Server, ServerBuilder}
3435

3536
class DASServer(resultCache: QueryResultCache)(

src/main/scala/com/rawlabs/das/server/grpc/TableServiceGrpcImpl.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import scala.jdk.CollectionConverters._
1818
import scala.jdk.OptionConverters._
1919
import scala.util.{Failure, Success}
2020

21+
import org.apache.pekko.NotUsed
22+
import org.apache.pekko.stream.scaladsl.{Keep, Sink, Source}
23+
import org.apache.pekko.stream.{KillSwitches, Materializer, UniqueKillSwitch}
24+
2125
import com.rawlabs.das.sdk.{DASExecuteResult, DASSdk, DASSdkUnsupportedException, DASTable}
2226
import com.rawlabs.das.server.cache.{QueryCacheKey, QueryResultCache}
2327
import com.rawlabs.das.server.manager.DASSdkManager
@@ -26,9 +30,6 @@ import com.rawlabs.protocol.das.v1.services._
2630
import com.rawlabs.protocol.das.v1.tables._
2731
import com.typesafe.scalalogging.StrictLogging
2832

29-
import akka.NotUsed
30-
import akka.stream.scaladsl.{Keep, Sink, Source}
31-
import akka.stream.{KillSwitches, Materializer, UniqueKillSwitch}
3233
import io.grpc.stub.{ServerCallStreamObserver, StreamObserver}
3334
import io.grpc.{Status, StatusRuntimeException}
3435

src/main/scala/com/rawlabs/das/server/webui/DASWebUIServer.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ package com.rawlabs.das.server.webui
1515
import scala.concurrent.ExecutionContext
1616
import scala.util.{Failure, Success}
1717

18-
import akka.actor.typed.ActorSystem
19-
import akka.http.scaladsl.Http
20-
import akka.http.scaladsl.server.Directives._
21-
import akka.stream.Materializer
18+
import org.apache.pekko.actor.typed.ActorSystem
19+
import org.apache.pekko.http.scaladsl.Http
20+
import org.apache.pekko.http.scaladsl.server.Directives._
21+
import org.apache.pekko.stream.Materializer
2222

2323
object DASWebUIServer {
2424

src/main/scala/com/rawlabs/das/server/webui/DebugAppService.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212

1313
package com.rawlabs.das.server.webui
1414

15+
import org.apache.pekko.http.scaladsl.model._
16+
1517
import com.rawlabs.das.server.cache.QueryResultCache
1618

17-
import akka.http.scaladsl.model._
1819
import scalatags.Text.all._
1920
import scalatags.Text.tags2.title
2021

src/test/scala/com/rawlabs/das/server/grpc/TablesServiceDASMockTestSpec.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import scala.concurrent.duration._
2020
import scala.jdk.CollectionConverters._
2121
import scala.util.Try
2222

23+
import org.apache.pekko.actor.typed.scaladsl.Behaviors
24+
import org.apache.pekko.actor.typed.{ActorSystem, Scheduler}
25+
import org.apache.pekko.stream.Materializer
26+
import org.apache.pekko.util.Timeout
2327
import org.scalatest.BeforeAndAfterAll
2428
import org.scalatest.concurrent.ScalaFutures
2529
import org.scalatest.matchers.should.Matchers
@@ -34,10 +38,6 @@ import com.rawlabs.protocol.das.v1.services._
3438
import com.rawlabs.protocol.das.v1.tables._
3539
import com.rawlabs.protocol.das.v1.types.{Value, ValueInt, ValueString}
3640

37-
import akka.actor.typed.scaladsl.Behaviors
38-
import akka.actor.typed.{ActorSystem, Scheduler}
39-
import akka.stream.Materializer
40-
import akka.util.Timeout
4141
import io.grpc.inprocess.{InProcessChannelBuilder, InProcessServerBuilder}
4242
import io.grpc.{ManagedChannel, Server, StatusRuntimeException}
4343

src/test/scala/com/rawlabs/das/server/grpc/TablesServiceHighConcurrencySpec.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import scala.concurrent.duration._
2020
import scala.concurrent.{Await, ExecutionContext, Future, Promise}
2121
import scala.util.{Random, Try}
2222

23+
import org.apache.pekko.actor.typed.scaladsl.Behaviors
24+
import org.apache.pekko.actor.typed.{ActorRef, ActorSystem, Scheduler}
25+
import org.apache.pekko.stream.{Materializer, SystemMaterializer}
26+
import org.apache.pekko.util.Timeout
2327
import org.scalatest.BeforeAndAfterAll
2428
import org.scalatest.concurrent.{Futures, ScalaFutures}
2529
import org.scalatest.matchers.should.Matchers
@@ -35,10 +39,6 @@ import com.rawlabs.protocol.das.v1.services._
3539
import com.rawlabs.protocol.das.v1.tables._
3640
import com.rawlabs.protocol.das.v1.types.{Value, ValueInt}
3741

38-
import akka.actor.typed.scaladsl.Behaviors
39-
import akka.actor.typed.{ActorRef, ActorSystem, Scheduler}
40-
import akka.stream.{Materializer, SystemMaterializer}
41-
import akka.util.Timeout
4242
import io.grpc.inprocess.{InProcessChannelBuilder, InProcessServerBuilder}
4343
import io.grpc.stub.{ClientCallStreamObserver, ClientResponseObserver}
4444
import io.grpc.{ManagedChannel, Server}

src/test/scala/com/rawlabs/das/server/grpc/TablesServiceIntegrationSpec.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import java.nio.file.Files
1818
import scala.concurrent.ExecutionContext
1919
import scala.util.Try
2020

21+
import org.apache.pekko.actor.typed.scaladsl.Behaviors
22+
// gRPC stubs
23+
import org.apache.pekko.actor.typed.{ActorSystem, Scheduler}
24+
import org.apache.pekko.stream.Materializer
25+
import org.apache.pekko.util.Timeout
2126
import org.scalatest.BeforeAndAfterAll
2227
import org.scalatest.concurrent.ScalaFutures
2328
import org.scalatest.matchers.should.Matchers
@@ -31,11 +36,6 @@ import com.rawlabs.protocol.das.v1.query.Query
3136
import com.rawlabs.protocol.das.v1.services._
3237
import com.rawlabs.protocol.das.v1.tables._
3338

34-
import akka.actor.typed.scaladsl.Behaviors
35-
// gRPC stubs
36-
import akka.actor.typed.{ActorSystem, Scheduler}
37-
import akka.stream.Materializer
38-
import akka.util.Timeout
3939
import io.grpc.inprocess.{InProcessChannelBuilder, InProcessServerBuilder}
4040
import io.grpc.{ManagedChannel, Server, StatusRuntimeException}
4141

0 commit comments

Comments
 (0)