Skip to content

Commit

Permalink
Merge pull request #62 from nulab/BLG_INTG-1603/migrate-to-pekko-from…
Browse files Browse the repository at this point in the history
…-akka

BLG_INTG-1603 Migration to Apache Pekko from Akka in migration tools
  • Loading branch information
jtakakura authored Aug 25, 2024
2 parents 0053e14 + c8df417 commit e8213c1
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 = ""
}
12 changes: 6 additions & 6 deletions src/main/scala/com/nulabinc/backlog/r2b/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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._

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.{
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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._

Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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._

Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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
import com.nulabinc.backlog.r2b.mapping.collector.core.{MappingContext, MappingData}
import com.taskadapter.redmineapi.bean.User
import monix.eval.Task
import monix.execution.Scheduler
import org.apache.pekko.actor.{Actor, Props}

/**
* @author
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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._

Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ 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}
import com.nulabinc.backlog.r2b.mapping.collector.core.{MappingContext, MappingData}
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._

Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down

0 comments on commit e8213c1

Please sign in to comment.