у меня есть работа с persistenceActor, но когда я вызываю метод persist (), обратный вызов никогда не достигает, я не могу найти никаких ошибок в терминале
код субъекта
class MajorEventActor extends Timers with PersistentActor with ActorLogging{
var currentSeqNr = 0;
timers.startTimerWithFixedDelay("majorevent",FetchMajor,1 hour)
override def receiveRecover: Receive = {
case value:MajorEvent =>
log.info("\u001b[31;1mrecovering major event")
currentSeqNr = currentSeqNr + 1
}
override def receiveCommand: Receive = {
case FetchMajor =>
log.info("start")
getMajorEvent.onComplete{
case Success(value) => //value is country
log.info(s"$value")
persist(value){e=>{
log.info(s"$e")
log.info("\u001b[32;1mvalue is persisted in levelDB")
currentSeqNr = currentSeqNr + 1
}}
log.info("complete")
case Failure(value) => println("\u001b[32;1merror from wikipedia")
}
}
override def persistenceId: String = "majorevent"
}
вывод терминала
[INFO] [05/03/2020 15:58:31.082] [main-akka.actor.default-dispatcher-4] [akka://main/user/event] start
[INFO] [05/03/2020 15:58:34.019] [main-akka.actor.default-dispatcher-5] [akka://main/user/event] MajorEvent(Major events of COVID19 pandemic in India in May,List(News(1 May,Nationwide lock-down further extended till 17 May), News(2 May,10,000 confirmed recoveries)))
[INFO] [05/03/2020 15:58:34.019] [main-akka.actor.default-dispatcher-5] [akka://main/user/event] complete
файл конфигурации
akka.persistence.journal.plugin = "akka.persistence.journal.leveldb"
akka.persistence.journal.leveldb.dir = "target/levelDB/journal"
akka.persistence.snapshot-store.plugin = "akka.persistence.snapshot-store.local"
akka.persistence.snapshot-store.local.dir = "target/levelDB/snapshots"
akka.actor.allow-java-serialization = on
основной класс
val majorEvent = actor.actorOf(Props[MajorEventActor],"event")
majorEvent ! FetchMajor