Skip to content

Commit

Permalink
Update to Play 3.0, switch Akka/Alpakka to Pekko/Pekko Connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesname committed Dec 5, 2024
1 parent 0cdbd52 commit c76b016
Show file tree
Hide file tree
Showing 133 changed files with 387 additions and 382 deletions.
2 changes: 2 additions & 0 deletions .ackrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
--ignore-dir=target
--ignore-dir=miniodata
--ignore-dir=DB
--ignore-dir=.idea
--ignore-file=match:application.log

# Add a type for messages, messages.en etc files
--type-set=messages:match:/messages(\.[a-z]{2})?/
Expand Down
2 changes: 1 addition & 1 deletion app/guice/SearchModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SearchModule extends AbstractModule {
bind(classOf[Index]).toProvider(classOf[SolrIndexProvider])
bind(classOf[ResponseParser]).to(classOf[SolrJsonResponseParser])
bind(classOf[QueryBuilder]).to(classOf[SolrQueryBuilder])
bind(classOf[SearchIndexMediator]).to(classOf[AkkaStreamsIndexMediator])
bind(classOf[SearchIndexMediator]).to(classOf[PekkoStreamsIndexMediator])
bind(classOf[SearchEngine]).to(classOf[SolrSearchEngine])
bind(classOf[SearchItemResolver]).to(classOf[GidSearchResolver])
}
Expand Down
26 changes: 13 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.typesafe.sbt.packager.SettingsHelper._
import com.typesafe.sbt.uglify.Import._
import com.typesafe.sbt.web.SbtWeb.autoImport._
import net.ground5hark.sbt.concat.Import._
import play.core.PlayVersion.{akkaHttpVersion, akkaVersion}
import play.core.PlayVersion.{pekkoHttpVersion, pekkoVersion}
import play.sbt.PlayImport._
import play.sbt.routes.RoutesKeys._
import play.twirl.sbt.Import.TwirlKeys.templateImports
Expand All @@ -22,7 +22,7 @@ val appName = "docview"

val backendVersion = "0.15.1"
val dataConverterVersion = "1.1.15"
val alpakkaVersion = "3.0.4"
val pekkoConnectorsVersion = "1.0.2"

// This prevents a library version incompatibility error between
// scala-xml 1.3.0 and 2.2.0 (which are in fact binary compatible.)
Expand All @@ -39,10 +39,10 @@ val backendDependencies = Seq(
"org.apache.commons" % "commons-text" % "1.4",

// Push JSON parser used for stream parsing...
"com.lightbend.akka" %% "akka-stream-alpakka-json-streaming" % alpakkaVersion,
"org.apache.pekko" %% "pekko-connectors-json-streaming" % pekkoConnectorsVersion,

// CSV parser/writer...
"com.lightbend.akka" %% "akka-stream-alpakka-csv" % alpakkaVersion,
"org.apache.pekko" %% "pekko-connectors-csv" % pekkoConnectorsVersion,

// IRI helper...
"org.apache.jena" % "jena-iri" % "3.9.0",
Expand All @@ -61,9 +61,9 @@ val coreDependencies = backendDependencies ++ Seq(
// Force Scala XML version
"org.scala-lang.modules" %% "scala-xml" % "2.2.0",

// Force Akka HTTP version
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion,
// Force Pekko HTTP version
"org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
"org.apache.pekko" %% "pekko-http-xml" % pekkoHttpVersion,

// Anorm DB lib
"org.playframework.anorm" %% "anorm" % "2.7.0",
Expand Down Expand Up @@ -109,29 +109,29 @@ val portalDependencies = Seq(
"eu.ehri-project" % "index-data-converter" % dataConverterVersion exclude("log4j", "log4j") exclude ("org.slf4j", "slf4j-log4j12"),

// S3 Upload plugin
"com.lightbend.akka" %% "akka-stream-alpakka-s3" % alpakkaVersion,
"org.apache.pekko" %% "pekko-connectors-s3" % pekkoConnectorsVersion,

// S3 sdk
"software.amazon.awssdk" % "s3" % "2.15.63",
"software.amazon.awssdk" % "s3" % "2.17.113",

// AWS Location sdk
"software.amazon.awssdk" % "location" % "2.15.63",
"software.amazon.awssdk" % "location" % "2.17.113",
)

val adminDependencies = Seq(
// EAD validation
"org.relaxng" % "jing" % "20181222",

// XML parsing
"com.lightbend.akka" %% "akka-stream-alpakka-xml" % alpakkaVersion,
"com.lightbend.akka" %% "akka-stream-alpakka-text" % alpakkaVersion,
"org.apache.pekko" %% "pekko-connectors-xml" % pekkoConnectorsVersion,
"org.apache.pekko" %% "pekko-connectors-text" % pekkoConnectorsVersion,
)

val testDependencies = Seq(
specs2 % Test,

// Used for testing JSON stream parsing...
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test
"org.apache.pekko" %% "pekko-stream-testkit" % pekkoVersion % Test
)

val additionalResolvers = Resolver.sonatypeOssRepos("releases") ++ Seq(
Expand Down
16 changes: 8 additions & 8 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ contexts {
}
}

# Akka S3 defaults
alpakka.s3.aws {
# Pekko S3 defaults
pekko.connectors.s3.aws {
path-style-access: false
credentials.provider: static
region.provider: static
Expand Down Expand Up @@ -195,9 +195,9 @@ storage {

# Classifier is basically the bucket name on AWS S3.
# Config refers to a block of configuration matching
# the Alpakka reference.conf:
# https://github.com/akka/alpakka/blob/master/s3/src/main/resources/reference.conf
# Make sure this is defined, i.e. config = ${alpakka.s3}
# the Pekko connectors reference.conf:
# https://github.com/apache/pekko-connectors/blob/main/s3/src/main/resources/reference.conf
# Make sure this is defined, i.e. config = ${pekko.connectors.s3}
portal {
classifier = disk-a
config = {}
Expand Down Expand Up @@ -444,9 +444,9 @@ ehri {
}

# Ensure indexer does not idle timeout
akka.http.host-connection-pool.client.idle-timeout = 5 minutes
akka.http.client.idle-timeout = 5 minutes
akka.http.server.idle-timeout = 5 minutes
pekko.http.host-connection-pool.client.idle-timeout = 5 minutes
pekko.http.client.idle-timeout = 5 minutes
pekko.http.server.idle-timeout = 5 minutes

# Ensure websocket connections do not idle timeout
play.server.websocket.periodic-keep-alive-max-idle = 10 seconds
Expand Down
2 changes: 1 addition & 1 deletion conf/aws.conf.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
akka.stream.alpakka.s3.aws {
pekko.stream.connectors.s3.aws {
# e.g. "eu-west-1"
region.default-region=

Expand Down
4 changes: 2 additions & 2 deletions conf/logback-play-dev.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<appender-ref ref="STDOUT" />
</appender>

<logger name="akka" level="WARN" />
<logger name="pekko" level="WARN" />
<logger name="play" level="INFO" />

<!-- Off these ones as they are annoying, and anyway we manage configuration ourself -->
Expand Down Expand Up @@ -76,7 +76,7 @@
<!-- Uncomment to see mailer debug, when play.mailer.debug=yes in configuration -->
<!-- <logger name="play.mailer" level="DEBUG" />-->

<!--<logger name="akka.stream" level="TRACE" />-->
<!--<logger name="pekko.stream" level="TRACE" />-->

<!-- Uncomment to show LOTS of debug info about HTTP calls -->
<!-- <logger name="play.shaded.ahc.org.asynchttpclient" level="DEBUG" />-->
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/app/actors/Ticker.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package actors

import actors.Ticker.Tick
import akka.actor.{Actor, ActorRef, Cancellable}
import org.apache.pekko.actor.{Actor, ActorRef, Cancellable}

import scala.concurrent.ExecutionContext
import scala.concurrent.duration.{DurationInt, FiniteDuration}
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/actors/cleanup/CleanupRunner.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package actors.cleanup

import actors.Ticker
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, Props}
import play.api.Configuration
import services.data.{DataService, EventForwarder}
import services.ingest.{Cleanup, ImportLogService, IngestService}
Expand Down Expand Up @@ -45,7 +45,7 @@ case class CleanupRunner(
)(implicit config: Configuration, ec: ExecutionContext) extends Actor with ActorLogging {

import CleanupRunner._
import akka.pattern._
import org.apache.pekko.pattern._

private val batchSize = config.get[Int]("ehri.admin.bulkOperations.maxDeletions")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package actors.cleanup
import actors.LongRunningJob.Cancel
import actors.Ticker.Tick
import actors.cleanup.CleanupRunner.CleanupJob
import akka.actor.{Actor, ActorContext, ActorLogging, ActorRef, Terminated}
import org.apache.pekko.actor.{Actor, ActorContext, ActorLogging, ActorRef, Terminated}
import play.api.i18n.Messages
import services.ingest.Cleanup
import utils.WebsocketConstants
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/actors/datamodel/Auditor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package actors.datamodel

import actors.LongRunningJob.Cancel
import actors.datamodel.AuditorManager.{AuditTask, AuditorJob}
import akka.actor.{Actor, ActorLogging, ActorRef}
import akka.pattern._
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef}
import org.apache.pekko.pattern._
import models._
import services.data.DataUser
import services.search._
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/actors/datamodel/AuditorManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package actors.datamodel
import actors.LongRunningJob.Cancel
import actors.datamodel.Auditor.{Cancelled, CheckBatch, Checked, Completed, RunAudit}
import actors.datamodel.AuditorManager.{AuditorJob, ItemResult}
import akka.actor.SupervisorStrategy.Stop
import akka.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, SupervisorStrategy, Terminated}
import org.apache.pekko.actor.SupervisorStrategy.Stop
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, SupervisorStrategy, Terminated}
import models._
import play.api.Configuration
import play.api.i18n.Messages
Expand Down
8 changes: 4 additions & 4 deletions modules/admin/app/actors/harvesting/HarvesterManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package actors.harvesting

import actors.LongRunningJob.Cancel
import actors.harvesting.Harvester.HarvestJob
import akka.actor.Status.Failure
import akka.actor.SupervisorStrategy.Stop
import akka.actor.{Actor, ActorContext, ActorLogging, ActorRef, OneForOneStrategy, SupervisorStrategy, Terminated}
import org.apache.pekko.actor.Status.Failure
import org.apache.pekko.actor.SupervisorStrategy.Stop
import org.apache.pekko.actor.{Actor, ActorContext, ActorLogging, ActorRef, OneForOneStrategy, SupervisorStrategy, Terminated}
import models.UserProfile
import play.api.i18n.Messages
import services.harvesting.{HarvestEventHandle, HarvestEventService, OaiPmhError}
Expand All @@ -26,7 +26,7 @@ case class HarvesterManager(job: HarvestJob, init: ActorContext => ActorRef, eve
import Harvester._
import HarvesterManager._
import OaiPmhHarvester._
import akka.pattern.pipe
import org.apache.pekko.pattern.pipe

override def supervisorStrategy: SupervisorStrategy = OneForOneStrategy() {
case e =>
Expand Down
6 changes: 3 additions & 3 deletions modules/admin/app/actors/harvesting/OaiPmhHarvester.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package actors.harvesting

import actors.LongRunningJob.Cancel
import actors.harvesting.Harvester.HarvestJob
import akka.actor.Status.Failure
import akka.actor.{Actor, ActorLogging, ActorRef}
import org.apache.pekko.actor.Status.Failure
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef}
import models.{OaiPmhConfig, UserProfile}
import services.harvesting.{OaiPmhClient, OaiPmhError}
import services.storage.FileStorage
Expand Down Expand Up @@ -55,7 +55,7 @@ case class OaiPmhHarvester (client: OaiPmhClient, storage: FileStorage)(
implicit userOpt: Option[UserProfile], ec: ExecutionContext) extends Actor with ActorLogging {
import Harvester._
import OaiPmhHarvester._
import akka.pattern.pipe
import org.apache.pekko.pattern.pipe

override def postStop(): Unit = {
log.debug("Harvester shut down")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package actors.harvesting

import actors.LongRunningJob.Cancel
import actors.harvesting.Harvester.HarvestJob
import akka.actor.Status.Failure
import akka.actor.{Actor, ActorLogging, ActorRef}
import akka.http.scaladsl.model.Uri
import org.apache.pekko.actor.Status.Failure
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef}
import org.apache.pekko.http.scaladsl.model.Uri
import models.{FileLink, ResourceSyncConfig, UserProfile}
import services.harvesting.ResourceSyncClient
import services.storage.FileStorage
Expand Down Expand Up @@ -44,7 +44,7 @@ case class ResourceSyncHarvester (client: ResourceSyncClient, storage: FileStora
implicit userOpt: Option[UserProfile], ec: ExecutionContext) extends Actor with ActorLogging {
import Harvester._
import ResourceSyncHarvester._
import akka.pattern.pipe
import org.apache.pekko.pattern.pipe

override def receive: Receive = {
// Start the initial harvest
Expand Down
10 changes: 5 additions & 5 deletions modules/admin/app/actors/harvesting/UrlSetHarvester.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package actors.harvesting

import actors.LongRunningJob.Cancel
import actors.harvesting.Harvester.HarvestJob
import akka.actor.Status.Failure
import akka.actor.{Actor, ActorLogging, ActorRef}
import akka.stream.scaladsl.Source
import akka.util.ByteString
import org.apache.pekko.actor.Status.Failure
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef}
import org.apache.pekko.stream.scaladsl.Source
import org.apache.pekko.util.ByteString
import models.{BasicAuthConfig, UrlNameMap, UrlSetConfig, UserProfile}
import play.api.http.HeaderNames
import play.api.libs.ws.{WSAuthScheme, WSClient}
Expand Down Expand Up @@ -45,7 +45,7 @@ case class UrlSetHarvester (client: WSClient, storage: FileStorage)(
implicit userOpt: Option[UserProfile], ec: ExecutionContext) extends Actor with ActorLogging {
import Harvester._
import UrlSetHarvester._
import akka.pattern.pipe
import org.apache.pekko.pattern.pipe

override def receive: Receive = {
// Start the initial harvest
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/actors/ingest/DataImporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package actors.ingest

import actors.Ticker
import actors.ingest.DataImporter._
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.pattern._
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, Props}
import org.apache.pekko.pattern._
import models._
import services.ingest.IngestService.{IngestData, IngestJob}
import services.ingest._
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/actors/ingest/DataImporterManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package actors.ingest

import actors.Ticker.Tick
import actors.ingest.DataImporter.{Done, Start, Message, UnexpectedError}
import akka.actor.SupervisorStrategy.Stop
import akka.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, SupervisorStrategy, Terminated}
import org.apache.pekko.actor.SupervisorStrategy.Stop
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, SupervisorStrategy, Terminated}
import models.{ErrorLog, ImportLog}
import services.ingest.IngestService.{IngestData, IngestJob}
import services.ingest._
Expand Down
8 changes: 4 additions & 4 deletions modules/admin/app/actors/transformation/XmlConverter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package actors.transformation
import actors.LongRunningJob.Cancel
import actors.transformation.XmlConverter._
import actors.transformation.XmlConverterManager.XmlConvertJob
import akka.actor.{Actor, ActorLogging, ActorRef, Scheduler}
import akka.stream.Materializer
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, Scheduler}
import org.apache.pekko.stream.Materializer
import services.transformation.utils.getUtf8Transcoder
import models.UserProfile
import services.storage.{FileMeta, FileStorage}
Expand Down Expand Up @@ -43,7 +43,7 @@ case class XmlConverter (job: XmlConvertJob, transformer: XmlTransformer, storag

private val transformDigest: String = services.transformation.utils.digest(job.data.transformers)

import akka.pattern.pipe
import org.apache.pekko.pattern.pipe

override def receive: Receive = {
// Start the initial harvest
Expand Down Expand Up @@ -94,7 +94,7 @@ case class XmlConverter (job: XmlConvertJob, transformer: XmlTransformer, storag

// Fetching a file
case Convert(file :: others, truncated, _, count, fresh) =>
import akka.pattern.retry
import org.apache.pekko.pattern.retry
implicit val scheduler: Scheduler = context.system.scheduler

context.become(running(msgTo, count, fresh, total, start))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package actors.transformation
import actors.LongRunningJob.Cancel
import actors.transformation.XmlConverter._
import actors.transformation.XmlConverterManager.XmlConvertJob
import akka.actor.SupervisorStrategy.Stop
import akka.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, SupervisorStrategy, Terminated}
import akka.stream.Materializer
import org.apache.pekko.actor.SupervisorStrategy.Stop
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, OneForOneStrategy, Props, SupervisorStrategy, Terminated}
import org.apache.pekko.stream.Materializer
import models.{TransformationType, UserProfile}
import play.api.i18n.Messages
import play.api.libs.json.JsObject
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/app/controllers/admin/Indexing.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package controllers.admin

import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import org.apache.pekko.actor.{Actor, ActorRef, ActorSystem, Props}
import controllers.AppComponents
import controllers.base.AdminController
import models.EntityType
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/controllers/admin/Ingest.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package controllers.admin

import actors.ingest.DataImporterManager
import akka.actor.Props
import akka.stream.Materializer
import org.apache.pekko.actor.Props
import org.apache.pekko.stream.Materializer
import controllers.AppComponents
import controllers.base.AdminController
import controllers.datasets.StorageHelpers
Expand Down
4 changes: 2 additions & 2 deletions modules/admin/app/controllers/admin/Tasks.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package controllers.admin

import actors.LongRunningJob
import akka.actor.{Actor, ActorLogging, ActorNotFound, ActorSystem, Props}
import akka.stream.{Materializer, OverflowStrategy}
import org.apache.pekko.actor.{Actor, ActorLogging, ActorNotFound, ActorSystem, Props}
import org.apache.pekko.stream.{Materializer, OverflowStrategy}
import controllers.AppComponents
import controllers.base.AdminController
import play.api.libs.json.{JsNull, JsValue, Json}
Expand Down
Loading

0 comments on commit c76b016

Please sign in to comment.