is the ActorPath
to the actor to which all messages will be forwarded.
targetPath
can point to a local or remote actor, but the tunnel endpoint will be
deployed remotely on the node where the target actor lives.
is the ACK timeout after which all outstanding messages will be resent. There is no limit on the queue size or the number of retries.
is an optional interval between connection attempts.
It is also used as the interval between receiving a Terminated
for the tunnel and
attempting to reconnect to the target actor. The minimum recommended value for this is
the value of the configuration setting akka.remote.retry-gate-closed-for
. Use None
to never reconnect after a disconnection.
is an optional maximum number of attempts to connect to the
target actor. Use None
for no limit. If reconnectAfter
is None
this value is ignored.
Returns the next retry interval duration.
Returns the next retry interval duration. By default each interval is the same, reconnectAfter.
Reset backoff interval.
Reset backoff interval.
This and nextBackoff are meant to be implemented by subclasses.
(reliableProxy: ArrowAssoc[ReliableProxy]).->(y)
A ReliableProxy is a means to wrap a remote actor reference in order to obtain certain improved delivery guarantees:
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:
or in Java:
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.
(Since version 2.5.0) Use AtLeastOnceDelivery instead