package pattern
- Alphabetic
- Public
- All
Type Members
-
trait
Aggregator
extends AnyRef
The aggregator is to be mixed into an actor for the aggregator behavior.
-
trait
ReceivePipeline
extends Actor
Trait implementing Receive Pipeline Pattern.
Trait implementing Receive Pipeline Pattern. Mixin this trait for configuring a chain of interceptors to be applied around Actor's current behavior.
-
class
ReliableProxy
extends Actor with LoggingFSM[State, Vector[Message]] with ReliableProxyDebugLogging
A ReliableProxy is a means to wrap a remote actor reference in order to obtain certain improved delivery guarantees:
A ReliableProxy is a means to wrap a remote actor reference in order to obtain certain improved delivery guarantees:
- as long as the proxy is not terminated before it sends all of its queued messages then no messages will be lost
- messages re-sent due to the first point will not be delivered out-of-order, message ordering is preserved
These guarantees are valid for the communication between the two end-points of the reliable “tunnel”, which usually spans an unreliable network.
Note that the ReliableProxy guarantees at-least-once, not exactly-once, delivery.
Delivery from the remote end-point to the target actor is still subject to in-JVM delivery semantics (i.e. not strictly guaranteed due to possible OutOfMemory situations or other VM errors).
You can create a reliable connection like this:
In Scala:
val proxy = context.actorOf(ReliableProxy.props(target, 100.millis, 120.seconds)
or in Java:
final ActorRef proxy = getContext().actorOf(ReliableProxy.props( target, Duration.create(100, "millis"), Duration.create(120, "seconds")));
Please note: the tunnel is uni-directional, and original sender information is retained, hence replies by the wrapped target reference will go back in the normal “unreliable” way unless also secured by a ReliableProxy from the remote end.
Message Types
This actor is an akka.actor.FSM, hence it offers the service of transition callbacks to those actors which subscribe using the
SubscribeTransitionCallBack
andUnsubscribeTransitionCallBack
messages; see akka.actor.FSM for more documentation. The proxy will transition intoReliableProxy.Active
state when ACKs are outstanding and return to theReliableProxy.Idle
state when every message send so far has been confirmed by the peer end-point.The initial state of the proxy is
ReliableProxy.Connecting
. In this state the proxy will repeatedly send akka.actor.Identify messages toActorSelection(targetPath)
in order to obtain a newActorRef
for the target. When an akka.actor.ActorIdentity for the target is received a new tunnel will be created, a ReliableProxy.TargetChanged message containing the targetActorRef
will be sent to the proxy's transition subscribers and the proxy will transition into either theReliableProxy.Idle
orReliableProxy.Active
state, depending if there are any outstanding messages that need to be delivered. IfmaxConnectAttempts
is defined this actor will stop itself afterIdentify
is sentmaxConnectAttempts
times.While in the
Idle
orActive
states, if a communication failure causes the tunnel to terminate via Remote Deathwatch the proxy will transition into theReliableProxy.Connecting
state as described above. After reconnectingTargetChanged
will be sent only if the targetActorRef
has changed.If this actor is stopped and it still has outstanding messages a ReliableProxy.ProxyTerminated message will be sent to the transition subscribers. It contains an
Unsent
object with the outstanding messages.If an ReliableProxy.Unsent message is sent to this actor the messages contained within it will be relayed through the tunnel to the target.
Any other message type sent to this actor will be delivered via a remote-deployed child actor to the designated target.
Failure Cases
All failures of either the local or the remote end-point are escalated to the parent of this actor; there are no specific error cases which are predefined.
Arguments
See the constructor below for the arguments for this actor. However, prefer using akka.contrib.pattern.ReliableProxy#props to this actor's constructor.
-
class
WorkList
[T] extends AnyRef
Fast, small, and dirty implementation of a linked list that removes transient work entries once they are processed.
Fast, small, and dirty implementation of a linked list that removes transient work entries once they are processed. The list is not thread safe! However it is expected to be reentrant. This means a processing function can add/remove entries from the list while processing. Most important, a processing function can remove its own entry from the list. The first remove must return true and any subsequent removes must return false.
Value Members
- object ReceivePipeline
- object ReliableProxy
-
object
WorkList
Provides the utility methods and constructors to the WorkList class.