Skip to content

Commit

Permalink
Fix use plugin dispatcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigogdea committed Dec 27, 2019
1 parent 04d17e4 commit a8760ad
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lazy val rxmongoVersion = "0.18.8"

name := "akka-reactivemongo-plugin"
organization := "null-vector"
version := "1.2.8"
version := "1.2.9"
scalaVersion := scala213
crossScalaVersions := supportedScalaVersions
scalacOptions ++= Seq(
Expand Down
19 changes: 4 additions & 15 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
akka-persistence-reactivemongo-journal-dispatcher {
# Dispatcher is the name of the action-based dispatcher
akka-persistence-reactivemongo-dispatcher {
type = Dispatcher
# What kind of ExecutionService to use
executor = "thread-pool-executor"
# Configuration for the thread pool
thread-pool-executor {
# minimum number of threads to cap factor-based core number to
core-pool-size-min = 2
# No of core threads ... ceil(available processors * factor)
core-pool-size-factor = 2.0
# maximum number of threads to cap factor-based number to
core-pool-size-max = 10
}
# Throughput defines the maximum number of messages to be
# processed per actor before the thread jumps to the next actor.
# Set to 1 for as fair as possible.
throughput = 100
throughput = 1
}

akka-persistence-reactivemongo-journal {
# Class name of the plugin.
class = "org.nullvector.journal.ReactiveMongoJournal"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka-persistence-reactivemongo-journal-dispatcher"
plugin-dispatcher = "akka-persistence-reactivemongo-dispatcher"
}

akka-persistence-reactivemongo-snapshot {
# Class name of the plugin.
class = "org.nullvector.snapshot.ReactiveMongoSnapshotStore"
# Dispatcher for the plugin actor.
plugin-dispatcher = "akka-persistence-reactivemongo-journal-dispatcher"
plugin-dispatcher = "akka-persistence-reactivemongo-dispatcher"
}

akka-persistence-reactivemongo {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/nullvector/ReactiveMongoDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object ReactiveMongoDriver extends ExtensionId[ReactiveMongoDriver] with Extensi

class ReactiveMongoDriver(system: ExtendedActorSystem) extends Extension {

protected implicit val dispatcher: ExecutionContext = system.dispatchers.lookup("akka-persistence-reactivemongo-journal-dispatcher")
protected implicit val dispatcher: ExecutionContext = system.dispatchers.lookup("akka-persistence-reactivemongo-dispatcher")

private implicit val timeout: Timeout = Timeout(5.seconds)
private val collections: ActorRef = system.actorOf(Props(new Collections()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object ReactiveMongoEventSerializer extends ExtensionId[ReactiveMongoEventSerial

class ReactiveMongoEventSerializer(system: ExtendedActorSystem) extends Extension {

protected implicit val dispatcher: ExecutionContext = system.dispatchers.lookup("akka-persistence-reactivemongo-journal-dispatcher")
protected implicit val dispatcher: ExecutionContext = system.dispatchers.lookup("akka-persistence-reactivemongo-dispatcher")

private val adapterRegistryRef: ActorRef = system.actorOf(Props(new EventAdapterRegistry()))

Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/org/nullvector/ReactiveMongoPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ trait ReactiveMongoPlugin {
val config: Config
val actorSystem: ActorSystem

protected lazy val serializer = ReactiveMongoEventSerializer(actorSystem)
protected lazy val rxDriver = ReactiveMongoDriver(actorSystem)
protected implicit lazy val dispatcher: ExecutionContext = actorSystem.dispatcher
protected lazy val serializer: ReactiveMongoEventSerializer = ReactiveMongoEventSerializer(actorSystem)
protected lazy val rxDriver: ReactiveMongoDriver = ReactiveMongoDriver(actorSystem)
protected implicit lazy val dispatcher: ExecutionContext = actorSystem.dispatchers.lookup("akka-persistence-reactivemongo-dispatcher")

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ReactiveMongoScalaReadJournal(system: ExtendedActorSystem)

protected lazy val serializer: ReactiveMongoEventSerializer = ReactiveMongoEventSerializer(system)
protected lazy val rxDriver: ReactiveMongoDriver = ReactiveMongoDriver(system)
protected implicit lazy val dispatcher: ExecutionContext = system.dispatchers.lookup("akka-persistence-reactivemongo-journal-dispatcher")
protected implicit lazy val dispatcher: ExecutionContext = system.dispatchers.lookup("akka-persistence-reactivemongo-dispatcher")
protected implicit lazy val materializer: Materializer = Materializer.matFromSystem(system)

protected val defaultRefreshInterval: FiniteDuration =
Expand Down

0 comments on commit a8760ad

Please sign in to comment.