From c8df4170b4afd555b5dcaf45180b9fd0c728368b Mon Sep 17 00:00:00 2001 From: Junji Takakura Date: Fri, 5 Jul 2024 13:58:24 +0900 Subject: [PATCH] BLG_INTG-1603 Migration to Apache Pekko from Akka in migration tools --- common | 2 +- src/main/resources/application.conf | 8 ++++---- src/main/scala/com/nulabinc/backlog/r2b/Main.scala | 12 ++++++------ .../backlog/r2b/exporter/actor/ContentActor.scala | 2 +- .../backlog/r2b/exporter/actor/IssueActor.scala | 2 +- .../backlog/r2b/exporter/actor/IssuesActor.scala | 8 ++++---- .../backlog/r2b/exporter/actor/WikiActor.scala | 2 +- .../backlog/r2b/exporter/actor/WikisActor.scala | 8 ++++---- .../r2b/exporter/service/ProjectExporter.scala | 2 +- .../r2b/mapping/collector/actor/ContentActor.scala | 2 +- .../r2b/mapping/collector/actor/IssueActor.scala | 2 +- .../r2b/mapping/collector/actor/IssuesActor.scala | 8 ++++---- .../r2b/mapping/collector/actor/WikiActor.scala | 2 +- .../r2b/mapping/collector/actor/WikisActor.scala | 8 ++++---- .../mapping/collector/service/MappingCollector.scala | 2 +- 15 files changed, 35 insertions(+), 35 deletions(-) diff --git a/common b/common index 4199917..f8759cc 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 419991785cafea2abd6849d1562194f2b06666bd +Subproject commit f8759ccf506cd20d82b0a9d1bd070323ae3fea3b diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 74274e5..f94e5e3 100755 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -1,6 +1,6 @@ -akka { - loggers = ["akka.event.slf4j.Slf4jLogger"] - event-handlers = ["akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"] + event-handlers = ["org.apache.pekko.event.slf4j.Slf4jLogger"] loglevel = INFO actor.default-dispatcher.fork-join-executor { # Min number of threads to cap factor-based parallelism number to @@ -20,7 +20,7 @@ application { backlog4jVersion = "2.5.2" export-limit-at-once = 100 language=default - akka.mailbox-pool = 100 + pekko.mailbox-pool = 100 defaultRetryCount = 3 iaah = "" } diff --git a/src/main/scala/com/nulabinc/backlog/r2b/Main.scala b/src/main/scala/com/nulabinc/backlog/r2b/Main.scala index 964bae1..5c2bfd4 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/Main.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/Main.scala @@ -3,7 +3,6 @@ package com.nulabinc.backlog.r2b import java.nio.file.Paths import java.util.Locale -import akka.actor.ActorSystem import com.nulabinc.backlog.migration.common.client.IAAH import com.nulabinc.backlog.migration.common.conf.{ BacklogApiConfiguration, @@ -12,9 +11,9 @@ import com.nulabinc.backlog.migration.common.conf.{ } import com.nulabinc.backlog.migration.common.errors.{MappingFileNotFound, MappingValidationError} import com.nulabinc.backlog.migration.common.interpreters.{ - AkkaHttpDSL, JansiConsoleDSL, LocalStorageDSL, + PekkoHttpDSL, SQLiteStoreDSL } import com.nulabinc.backlog.migration.common.messages.ConsoleMessages @@ -28,6 +27,7 @@ import com.nulabinc.backlog.r2b.utils.{ClassVersion, DisableSSLCertificateCheckU import com.osinka.i18n.Messages import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.ActorSystem import org.fusesource.jansi.AnsiConsole import org.rogach.scallop._ @@ -41,10 +41,10 @@ object R2B extends BacklogConfiguration with Logging { private implicit val system: ActorSystem = ActorSystem("main") private implicit val exc: Scheduler = monix.execution.Scheduler.Implicits.global - private implicit val storageDSL = LocalStorageDSL() - private implicit val consoleDSL = JansiConsoleDSL() - private implicit val storeDSL = SQLiteStoreDSL(dbPath) - private implicit val httpDSL: AkkaHttpDSL = new AkkaHttpDSL() + private implicit val storageDSL = LocalStorageDSL() + private implicit val consoleDSL = JansiConsoleDSL() + private implicit val storeDSL = SQLiteStoreDSL(dbPath) + private implicit val httpDSL: PekkoHttpDSL = new PekkoHttpDSL() def main(args: Array[String]): Unit = { consoleDSL diff --git a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/ContentActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/ContentActor.scala index 23f51a1..d14b543 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/ContentActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/ContentActor.scala @@ -1,12 +1,12 @@ package com.nulabinc.backlog.r2b.exporter.actor -import akka.actor.{Actor, Props} import com.nulabinc.backlog.migration.common.domain.BacklogTextFormattingRule import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL import com.nulabinc.backlog.migration.common.utils.Logging import com.nulabinc.backlog.r2b.exporter.core.ExportContext import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.{Actor, Props} /** * @author diff --git a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssueActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssueActor.scala index 343d7a9..0061180 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssueActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssueActor.scala @@ -2,7 +2,6 @@ package com.nulabinc.backlog.r2b.exporter.actor import java.util.concurrent.CountDownLatch -import akka.actor.Actor import better.files.File import com.nulabinc.backlog.migration.common.convert.Convert import com.nulabinc.backlog.migration.common.domain.{ @@ -20,6 +19,7 @@ import com.nulabinc.backlog.r2b.exporter.service.{ } import com.taskadapter.redmineapi.Include import com.taskadapter.redmineapi.bean.{Attachment, _} +import org.apache.pekko.actor.Actor import spray.json._ import scala.concurrent.ExecutionContext.Implicits.global diff --git a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssuesActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssuesActor.scala index a609843..f4a41c0 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssuesActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/IssuesActor.scala @@ -2,9 +2,6 @@ package com.nulabinc.backlog.r2b.exporter.actor import java.util.concurrent.CountDownLatch -import akka.actor.SupervisorStrategy.Restart -import akka.actor.{Actor, ActorRef, OneForOneStrategy, Props} -import akka.routing.SmallestMailboxPool import com.nulabinc.backlog.migration.common.conf.BacklogConfiguration import com.nulabinc.backlog.migration.common.domain.BacklogTextFormattingRule import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL @@ -14,6 +11,9 @@ import com.nulabinc.backlog4j.BacklogAPIException import com.osinka.i18n.Messages import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.SupervisorStrategy.Restart +import org.apache.pekko.actor.{Actor, ActorRef, OneForOneStrategy, Props} +import org.apache.pekko.routing.SmallestMailboxPool import scala.concurrent.duration._ @@ -61,7 +61,7 @@ private[exporter] class IssuesActor( def receive: Receive = { case IssuesActor.Do => val router = - SmallestMailboxPool(akkaMailBoxPool, supervisorStrategy = strategy) + SmallestMailboxPool(pekkoMailBoxPool, supervisorStrategy = strategy) val issueActor = context.actorOf( router.props( Props(new IssueActor(exportContext, backlogTextFormattingRule)) diff --git a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikiActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikiActor.scala index 712aeec..2c4e910 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikiActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikiActor.scala @@ -3,12 +3,12 @@ package com.nulabinc.backlog.r2b.exporter.actor import java.net.URL import java.util.concurrent.CountDownLatch -import akka.actor.Actor import com.nulabinc.backlog.migration.common.convert.Convert import com.nulabinc.backlog.migration.common.utils.{IOUtil, Logging} import com.nulabinc.backlog.r2b.exporter.core.ExportContext import com.nulabinc.backlog.r2b.exporter.service.AttachmentService import com.taskadapter.redmineapi.bean.WikiPage +import org.apache.pekko.actor.Actor import spray.json._ import scala.concurrent.ExecutionContext.Implicits.global diff --git a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikisActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikisActor.scala index 7526c08..c8f6a7d 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikisActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/exporter/actor/WikisActor.scala @@ -2,9 +2,6 @@ package com.nulabinc.backlog.r2b.exporter.actor import java.util.concurrent.CountDownLatch -import akka.actor.SupervisorStrategy.Restart -import akka.actor.{Actor, OneForOneStrategy, Props} -import akka.routing.SmallestMailboxPool import com.nulabinc.backlog.migration.common.conf.BacklogConfiguration import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL import com.nulabinc.backlog.migration.common.utils.{Logging, ProgressBar} @@ -13,6 +10,9 @@ import com.osinka.i18n.Messages import com.taskadapter.redmineapi.bean.WikiPage import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.SupervisorStrategy.Restart +import org.apache.pekko.actor.{Actor, OneForOneStrategy, Props} +import org.apache.pekko.routing.SmallestMailboxPool import scala.concurrent.duration._ @@ -43,7 +43,7 @@ private[exporter] class WikisActor(exportContext: ExportContext)(implicit def receive: Receive = { case WikisActor.Do => val router = - SmallestMailboxPool(akkaMailBoxPool, supervisorStrategy = strategy) + SmallestMailboxPool(pekkoMailBoxPool, supervisorStrategy = strategy) val wikiActor = context.actorOf(router.props(Props(new WikiActor(exportContext)))) wikis.foreach(wiki => wikiActor ! WikiActor.Do(wiki, completion, wikis.size, console)) diff --git a/src/main/scala/com/nulabinc/backlog/r2b/exporter/service/ProjectExporter.scala b/src/main/scala/com/nulabinc/backlog/r2b/exporter/service/ProjectExporter.scala index 3d5135f..594abb8 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/exporter/service/ProjectExporter.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/exporter/service/ProjectExporter.scala @@ -2,7 +2,6 @@ package com.nulabinc.backlog.r2b.exporter.service import javax.inject.Inject -import akka.actor.{ActorSystem, Props} import com.nulabinc.backlog.migration.common.conf.BacklogPaths import com.nulabinc.backlog.migration.common.convert.Convert import com.nulabinc.backlog.migration.common.domain._ @@ -17,6 +16,7 @@ import com.osinka.i18n.Messages import com.taskadapter.redmineapi.bean._ import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.{ActorSystem, Props} import spray.json._ import scala.collection.mutable diff --git a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/ContentActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/ContentActor.scala index c341979..1027215 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/ContentActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/ContentActor.scala @@ -1,6 +1,5 @@ package com.nulabinc.backlog.r2b.mapping.collector.actor -import akka.actor.{Actor, Props} import com.nulabinc.backlog.migration.common.conf.ExcludeOption import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL import com.nulabinc.backlog.migration.common.utils.Logging @@ -8,6 +7,7 @@ import com.nulabinc.backlog.r2b.mapping.collector.core.{MappingContext, MappingD import com.taskadapter.redmineapi.bean.User import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.{Actor, Props} /** * @author diff --git a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssueActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssueActor.scala index 20e8b2e..0ab0308 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssueActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssueActor.scala @@ -2,13 +2,13 @@ package com.nulabinc.backlog.r2b.mapping.collector.actor import java.util.concurrent.CountDownLatch -import akka.actor.Actor import com.nulabinc.backlog.migration.common.utils.Logging import com.nulabinc.backlog.r2b.mapping.collector.core.MappingData import com.nulabinc.backlog.r2b.redmine.conf.RedmineConstantValue import com.nulabinc.backlog.r2b.redmine.service.IssueService import com.taskadapter.redmineapi.Include import com.taskadapter.redmineapi.bean.{Issue, Journal, JournalDetail, User} +import org.apache.pekko.actor.Actor import scala.collection.mutable import scala.concurrent.ExecutionContext.Implicits.global diff --git a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssuesActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssuesActor.scala index c1ebd93..2bc11b4 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssuesActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/IssuesActor.scala @@ -2,9 +2,6 @@ package com.nulabinc.backlog.r2b.mapping.collector.actor import java.util.concurrent.CountDownLatch -import akka.actor.SupervisorStrategy.Restart -import akka.actor.{Actor, ActorRef, OneForOneStrategy, Props} -import akka.routing.SmallestMailboxPool import com.nulabinc.backlog.migration.common.conf.BacklogConfiguration import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL import com.nulabinc.backlog.migration.common.utils.{ConsoleOut, Logging, ProgressBar} @@ -14,6 +11,9 @@ import com.osinka.i18n.Messages import com.taskadapter.redmineapi.bean.User import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.SupervisorStrategy.Restart +import org.apache.pekko.actor.{Actor, ActorRef, OneForOneStrategy, Props} +import org.apache.pekko.routing.SmallestMailboxPool import scala.concurrent.duration._ @@ -59,7 +59,7 @@ private[collector] class IssuesActor(mappingContext: MappingContext)(implicit def receive: Receive = { case IssuesActor.Do(mappingData: MappingData, allUsers: Seq[User]) => val router = - SmallestMailboxPool(akkaMailBoxPool, supervisorStrategy = strategy) + SmallestMailboxPool(pekkoMailBoxPool, supervisorStrategy = strategy) val issueActor = context.actorOf( router.props( Props( diff --git a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikiActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikiActor.scala index 16aec79..cf03984 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikiActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikiActor.scala @@ -2,11 +2,11 @@ package com.nulabinc.backlog.r2b.mapping.collector.actor import java.util.concurrent.CountDownLatch -import akka.actor.Actor import com.nulabinc.backlog.migration.common.utils.Logging import com.nulabinc.backlog.r2b.mapping.collector.core.MappingData import com.nulabinc.backlog.r2b.redmine.service.WikiService import com.taskadapter.redmineapi.bean.{User, WikiPage, WikiPageDetail} +import org.apache.pekko.actor.Actor import scala.collection.mutable import scala.concurrent.ExecutionContext.Implicits.global diff --git a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikisActor.scala b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikisActor.scala index fc110b7..12d6645 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikisActor.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/actor/WikisActor.scala @@ -2,9 +2,6 @@ package com.nulabinc.backlog.r2b.mapping.collector.actor import java.util.concurrent.CountDownLatch -import akka.actor.SupervisorStrategy.Restart -import akka.actor.{Actor, OneForOneStrategy, Props} -import akka.routing.SmallestMailboxPool import com.nulabinc.backlog.migration.common.conf.BacklogConfiguration import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL import com.nulabinc.backlog.migration.common.utils.{Logging, ProgressBar} @@ -12,6 +9,9 @@ import com.nulabinc.backlog.r2b.mapping.collector.core.{MappingContext, MappingD import com.osinka.i18n.Messages import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.SupervisorStrategy.Restart +import org.apache.pekko.actor.{Actor, OneForOneStrategy, Props} +import org.apache.pekko.routing.SmallestMailboxPool import scala.concurrent.duration._ @@ -42,7 +42,7 @@ private[collector] class WikisActor(mappingContext: MappingContext)(implicit def receive: Receive = { case WikisActor.Do(mappingData: MappingData) => val router = - SmallestMailboxPool(akkaMailBoxPool, supervisorStrategy = strategy) + SmallestMailboxPool(pekkoMailBoxPool, supervisorStrategy = strategy) val wikiActor = context.actorOf( router.props( diff --git a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/service/MappingCollector.scala b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/service/MappingCollector.scala index c22ff38..59e1ecd 100644 --- a/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/service/MappingCollector.scala +++ b/src/main/scala/com/nulabinc/backlog/r2b/mapping/collector/service/MappingCollector.scala @@ -2,7 +2,6 @@ package com.nulabinc.backlog.r2b.mapping.collector.service import javax.inject.Inject -import akka.actor.{ActorSystem, Props} import com.nulabinc.backlog.migration.common.conf.ExcludeOption import com.nulabinc.backlog.migration.common.dsl.ConsoleDSL import com.nulabinc.backlog.migration.common.utils.{Logging, ProgressBar} @@ -13,6 +12,7 @@ import com.osinka.i18n.Messages import com.taskadapter.redmineapi.bean.{Group, Membership, User} import monix.eval.Task import monix.execution.Scheduler +import org.apache.pekko.actor.{ActorSystem, Props} import scala.concurrent.Await import scala.concurrent.duration.Duration