!per #3761 Reliable channels

- Built-in redelivery mechanism for Channel and PersistentChannel
- redelivery counter on ConfirmablePersistent
- redeliveries out of initial message delivery order
- relative order of redelivered messages is preserved
- configurable redelivery policy (ChannelSettings)
- Major refactorings of channels (and channel tests)
- Throughput load test for PersistentChannel

Todo:

- Paged/throtlled replay (another pull request)
- Resequencer (another pull request)
This commit is contained in:
Martin Krasser 2013-12-06 12:48:44 +01:00
parent 3231bb3729
commit 4e5ce5529c
27 changed files with 1980 additions and 844 deletions

View file

@ -9,7 +9,7 @@ import scala.collection.immutable
import scala.util._
import akka.actor.Actor
import akka.pattern.{ pipe, PromiseActorRef }
import akka.pattern.pipe
import akka.persistence._
/**
@ -40,8 +40,18 @@ trait SyncWriteJournal extends Actor with AsyncReplay {
} recover {
case e ReplayFailure(e)
} pipeTo (processor)
case c @ Confirm(processorId, sequenceNr, channelId)
confirm(processorId, sequenceNr, channelId)
case c @ Confirm(processorId, messageSequenceNr, channelId, wrapperSequenceNr, channelEndpoint)
if (wrapperSequenceNr == 0L) {
// A wrapperSequenceNr == 0L means that the corresponding message was delivered by a
// transient channel. We can now write a delivery confirmation for this message.
confirm(processorId, messageSequenceNr, channelId)
} else {
// A wrapperSequenceNr != 0L means that the corresponding message was delivered by a
// persistent channel. We can now safely delete the wrapper message (that contains the
// delivered message).
delete(channelId, wrapperSequenceNr, wrapperSequenceNr, true)
}
if (channelEndpoint != null) channelEndpoint ! c
if (extension.publishPluginCommands) context.system.eventStream.publish(c)
case d @ Delete(processorId, fromSequenceNr, toSequenceNr, permanent)
delete(processorId, fromSequenceNr, toSequenceNr, permanent)