| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Akka/Scala example source code file (AsyncRecovery.scala)

This example Akka source code file (AsyncRecovery.scala) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Akka and Scala source code examples by using tags.

All credit for the original source code belongs to; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Akka tags/keywords

akka, asyncrecovery, concurrent, future, journal, long, persistence, persistentrepr, string, unit

The AsyncRecovery.scala Akka example source code

 * Copyright (C) 2009-2014 Typesafe Inc. <>

package akka.persistence.journal

import scala.concurrent.Future

import akka.persistence.PersistentRepr

 * Asynchronous message replay and sequence number recovery interface.
trait AsyncRecovery {
   * Plugin API: asynchronously replays persistent messages. Implementations replay
   * a message by calling `replayCallback`. The returned future must be completed
   * when all messages (matching the sequence number bounds) have been replayed.
   * The future must be completed with a failure if any of the persistent messages
   * could not be replayed.
   * The `replayCallback` must also be called with messages that have been marked
   * as deleted. In this case a replayed message's `deleted` method must return
   * `true`.
   * The channel ids of delivery confirmations that are available for a replayed
   * message must be contained in that message's `confirms` sequence.
   * @param persistenceId persistent actor id.
   * @param fromSequenceNr sequence number where replay should start (inclusive).
   * @param toSequenceNr sequence number where replay should end (inclusive).
   * @param max maximum number of messages to be replayed.
   * @param replayCallback called to replay a single message. Can be called from any
   *                       thread.
   * @see [[AsyncWriteJournal]]
   * @see [[SyncWriteJournal]]
  def asyncReplayMessages(persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long, max: Long)(replayCallback: PersistentRepr ⇒ Unit): Future[Unit]

   * Plugin API: asynchronously reads the highest stored sequence number for the
   * given `persistenceId`.
   * @param persistenceId persistent actor id.
   * @param fromSequenceNr hint where to start searching for the highest sequence
   *                       number.
  def asyncReadHighestSequenceNr(persistenceId: String, fromSequenceNr: Long): Future[Long]

Other Akka source code examples

Here is a short list of links related to this Akka AsyncRecovery.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.