2014-01-17 06:58:25 +01:00
|
|
|
/**
|
2014-02-02 19:05:45 -06:00
|
|
|
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
2014-01-17 06:58:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package akka.persistence.journal.japi
|
|
|
|
|
|
|
|
|
|
import scala.concurrent.Future
|
|
|
|
|
|
|
|
|
|
import akka.actor.Actor
|
|
|
|
|
import akka.japi.Procedure
|
|
|
|
|
import akka.persistence.journal.{ AsyncRecovery ⇒ SAsyncReplay }
|
|
|
|
|
import akka.persistence.PersistentRepr
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Java API: asynchronous message replay and sequence number recovery interface.
|
|
|
|
|
*/
|
|
|
|
|
abstract class AsyncRecovery extends SAsyncReplay with AsyncRecoveryPlugin { this: Actor ⇒
|
|
|
|
|
import context.dispatcher
|
|
|
|
|
|
2014-06-23 14:33:35 +02:00
|
|
|
final def asyncReplayMessages(persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long, max: Long)(replayCallback: (PersistentRepr) ⇒ Unit) =
|
|
|
|
|
doAsyncReplayMessages(persistenceId, fromSequenceNr, toSequenceNr, max, new Procedure[PersistentRepr] {
|
2014-01-17 06:58:25 +01:00
|
|
|
def apply(p: PersistentRepr) = replayCallback(p)
|
|
|
|
|
}).map(Unit.unbox)
|
|
|
|
|
|
2014-06-23 14:33:35 +02:00
|
|
|
final def asyncReadHighestSequenceNr(persistenceId: String, fromSequenceNr: Long): Future[Long] =
|
|
|
|
|
doAsyncReadHighestSequenceNr(persistenceId, fromSequenceNr: Long).map(_.longValue)
|
2014-01-17 06:58:25 +01:00
|
|
|
}
|