Click or drag to resize
Akka.NETAtLeastOnceDeliveryActor Class
Persistent actor type that sends messages with at-least-once delivery semantics to destinations. It takes care of re-sending messages when they haven't been confirmed withing expected timeout. Use the Deliver(ActorPath, FuncInt64, Object, Boolean) method to send a message to a destination. Call the ConfirmDelivery(Int64) method when destination has replied with a confirmation message. At-least-once delivery implies that the original message send order is not always retained and the destination may receive duplicate messages due to possible resends. The interval between redelivery attempts can be defined with RedeliverInterval. After a number of delivery attempts a UnconfirmedWarning message will be sent to Self. The re-sending will continue, but you may choose ConfirmDelivery(Int64) to cancel re-sending. This actor type has a state consisting of unconfirmed messages and a sequence number. It does not store this state itself. You must persist events corresponding to the Deliver(ActorPath, FuncInt64, Object, Boolean) and ConfirmDelivery(Int64) invocations from your PersistentActor so that the state can be restored by calling the same methods during the recovery phase of the PersistentActor. Sometimes these events can be derived from other business level events, and sometimes you must create separate events. During recovery calls to Deliver(ActorPath, FuncInt64, Object, Boolean) will not send out the message, but it will be sent later if no matching ConfirmDelivery(Int64) was performed. Support for snapshot is provided by GetDeliverySnapshot and SetDeliverySnapshot(AtLeastOnceDeliverySnapshot). The AtLeastOnceDeliverySnapshot contains the full delivery state, including unconfirmed messages. If you need a custom snapshot for other parts of the actor state you must also include the AtLeastOnceDeliverySnapshot. It is serialized using protobuf with the ordinary Akka serialization mechanism. It is easiest to include the bytes of the AtLeastOnceDeliverySnapshot as a blob in your custom snapshot.
Inheritance Hierarchy

Namespace:  Akka.Persistence
Assembly:  Akka.Persistence (in Akka.Persistence.dll) Version: 1.1.3.30 (1.1.3.30)
Syntax
public abstract class AtLeastOnceDeliveryActor : PersistentActor

The AtLeastOnceDeliveryActor type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyInternalStashOverflowStrategy
TBD
(Inherited from Eventsourced.)
Public propertyIsRecovering
Returns true if this persistent entity is currently recovering.
(Inherited from Eventsourced.)
Public propertyIsRecoveryFinished
Returns true if this persistent entity has successfully finished recovery.
(Inherited from Eventsourced.)
Public propertyJournal
TBD
(Inherited from Eventsourced.)
Public propertyJournalPluginId
TBD
(Inherited from Eventsourced.)
Public propertyLastSequenceNr
Highest received sequence number so far or `0L` if this actor hasn't replayed or stored any persistent events yet.
(Inherited from Eventsourced.)
Protected propertyLog
TBD
(Inherited from Eventsourced.)
Public propertyMaxUnconfirmedMessages
Maximum number of unconfirmed messages, that this actor is allowed to hold in the memory. if this number is exceeded, Deliver(ActorPath, FuncInt64, Object, Boolean) will not accept more messages and it will throw MaxUnconfirmedMessagesExceededException. The default value can be configure with the 'akka.persistence.at-least-once-delivery.max-unconfirmed-messages' configuration key. This method can be overridden by implementation classes to return non-default values.
Public propertyPersistenceId
Id of the persistent entity for which messages should be replayed.
(Inherited from Eventsourced.)
Public propertyRecovery
Called when the persistent actor is started for the first time. The returned Recovery object defines how the actor will recover its persistent state behore handling the first incoming message. To skip recovery completely return None.
(Inherited from Eventsourced.)
Public propertyRedeliverInterval
Interval between redelivery attempts. The default value can be configure with the 'akka.persistence.at-least-once-delivery.redeliver-interval' configuration key. This method can be overridden by implementation classes to return non-default values.
Public propertyRedeliveryBurstLimit
Maximum number of unconfirmed messages that will be sent at each redelivery burst (burst frequency is half of the redelivery interval). If there's a lot of unconfirmed messages (e.g. if the destination is not available for a long time), this helps prevent an overwhelming amount of messages to be sent at once. The default value can be configure with the 'akka.persistence.at-least-once-delivery.redelivery-burst-limit' configuration key. This method can be overridden by implementation classes to return non-default values.
Protected propertySelf
Gets the self ActorRef
(Inherited from ActorBase.)
Protected propertySender
Gets the sending ActorRef of the current message
(Inherited from ActorBase.)
Public propertySnapshotPluginId
TBD
(Inherited from Eventsourced.)
Public propertySnapshotSequenceNr (Inherited from Eventsourced.)
Public propertySnapshotStore
TBD
(Inherited from Eventsourced.)
Public propertySnapshotterId
Returns PersistenceId.
(Inherited from Eventsourced.)
Public propertyStash
TBD
(Inherited from Eventsourced.)
Public propertyUnconfirmedCount
Number of messages that have not been confirmed yet.
Public propertyWarnAfterNumberOfUnconfirmedAttempts
After this number of delivery attempts a UnconfirmedWarning message will be sent to Self. The count is reset after restart. The default value can be configure with the 'akka.persistence.at-least-once-delivery.warn-after-number-of-unconfirmed-attempts' configuration key. This method can be overridden by implementation classes to return non-default values.
Top
Methods
  NameDescription
Public methodAroundPostRestart
TBD
(Inherited from Eventsourced.)
Public methodAroundPostStop
TBD
(Overrides EventsourcedAroundPostStop.)
Public methodAroundPreRestart
TBD
(Overrides EventsourcedAroundPreRestart(Exception, Object).)
Public methodAroundPreStart
TBD
(Inherited from Eventsourced.)
Protected methodAroundReceive
TBD
(Overrides EventsourcedAroundReceive(Receive, Object).)
Protected methodBecome(Receive)
Changes the actor's command behavior and replaces the current receive handler with the specified handler.
(Inherited from ActorBase.)
Protected methodBecome(Receive, Boolean) Obsolete.
TBD
(Inherited from ActorBase.)
Protected methodBecomeStacked
Changes the actor's behavior and replaces the current receive handler with the specified handler. The current handler is stored on a stack, and you can revert to it by calling UnbecomeStacked
Remarks
Please note, that in order to not leak memory, make sure every call to BecomeStacked(Receive) is matched with a call to UnbecomeStacked.
(Inherited from ActorBase.)
Public methodConfirmDelivery
Call this method when a message has been confirmed by the destination, or to abort re-sending.
Public methodDeferTEvent(IEnumerableTEvent, ActionTEvent) Obsolete.
TBD
(Inherited from Eventsourced.)
Public methodDeferTEvent(TEvent, ActionTEvent) Obsolete.
TBD
(Inherited from Eventsourced.)
Public methodDeferAsyncTEvent
Defer the handler execution until all pending handlers have been executed. Allows to define logic within the actor, which will respect the invocation-order-guarantee in respect to PersistAsyncTEvent(TEvent, ActionTEvent) calls. That is, if PersistAsyncTEvent(TEvent, ActionTEvent) was invoked before DeferAsyncTEvent(TEvent, ActionTEvent), the corresponding handlers will be invoked in the same order as they were registered in. This call will NOT result in evt being persisted, use PersistTEvent(TEvent, ActionTEvent) or PersistAsyncTEvent(TEvent, ActionTEvent) instead if the given evt should be possible to replay. If there are no pending persist handler calls, the handler will be called immediately. If persistence of an earlier event fails, the persistent actor will stop, and the handler will not be run.
(Inherited from Eventsourced.)
Public methodDeleteMessages
TBD
(Inherited from Eventsourced.)
Public methodDeleteSnapshot
Deletes the snapshot identified by sequenceNr. The PersistentActor will be notified about the status of the deletion via an DeleteSnapshotSuccess or DeleteSnapshotFailure message.
(Inherited from Eventsourced.)
Public methodDeleteSnapshots
Deletes all snapshots matching criteria. The PersistentActor will be notified about the status of the deletion via an DeleteSnapshotsSuccess or DeleteSnapshotsFailure message.
(Inherited from Eventsourced.)
Public methodDeliver(ActorPath, FuncInt64, Object)
Send the message created with deliveryMessageMapper function to the destination actor. It will retry sending the message until the delivery is confirmed with ConfirmDelivery(Int64). Correlation between these two methods is performed by deliveryId that is provided as parameter to the deliveryMessageMapper function. The deliveryId is typically passed in the message to the destination, which replies with a message containing the same 'deliveryId'. The 'deliveryId' is a strictly monotonically increasing sequence number without gaps. The same sequence is used for all destinations of the actor, i.e. when sending to multiple destinations the destinations will see gaps in the sequence if no translation is performed. During recovery this method will not send out the message, but it will be sent later if no matching ConfirmDelivery(Int64) was performed.
Public methodDeliver(ActorSelection, FuncInt64, Object)
Send the message created with deliveryMessageMapper function to the destination actor. It will retry sending the message until the delivery is confirmed with ConfirmDelivery(Int64). Correlation between these two methods is performed by deliveryId that is provided as parameter to the deliveryMessageMapper function. The deliveryId is typically passed in the message to the destination, which replies with a message containing the same 'deliveryId'. The 'deliveryId' is a strictly monotonically increasing sequence number without gaps. The same sequence is used for all destinations of the actor, i.e. when sending to multiple destinations the destinations will see gaps in the sequence if no translation is performed. During recovery this method will not send out the message, but it will be sent later if no matching ConfirmDelivery(Int64) was performed.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetDeliverySnapshot
Full state of the AtLeastOnceDeliveryActor. It can be saved with SaveSnapshot(Object). During recovery the snapshot received in SnapshotOffer should be set with SetDeliverySnapshot(AtLeastOnceDeliverySnapshot). The AtLeastOnceDeliverySnapshot contains the full delivery state, including unconfirmed messages. If you need a custom snapshot for other parts of the actor state you must also include the AtLeastOnceDeliverySnapshot. It is serialized using protobuf with the ordinary Akka serialization mechanism. It is easiest to include the bytes of the AtLeastOnceDeliverySnapshot as a blob in your custom snapshot.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLoadSnapshot
Instructs the snapshot store to load the specified snapshot and send it via an SnapshotOffer to the running PersistentActor.
(Inherited from Eventsourced.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnPersistFailure
Called when persist fails. By default it logs the error. Subclass may override to customize logging and for example send negative acknowledgment to sender. The actor is always stopped after this method has been invoked. Note that the event may or may not have been saved, depending on the type of failure.
(Inherited from Eventsourced.)
Protected methodOnPersistRejected (Inherited from Eventsourced.)
Protected methodOnRecoveryFailure
Called whenever a message replay fails. By default it log the errors.
(Inherited from Eventsourced.)
Protected methodOnReplaySuccess
TBD
(Overrides EventsourcedOnReplaySuccess.)
Public methodPersistTEvent(IEnumerableTEvent, ActionTEvent) Obsolete.
TBD
(Inherited from Eventsourced.)
Public methodPersistTEvent(TEvent, ActionTEvent)
Asynchronously persists an event. On successful persistence, the handler is called with the persisted event. This method guarantees that no new commands will be received by a persistent actor between a call to PersistTEvent(TEvent, ActionTEvent) and execution of it's handler. It also holds multiple persist calls per received command. Internally this is done by stashing. The stash used for that is an internal stash which doesn't interfere with the inherited user stash. An event handler may close over eventsourced actor state and modify it. Sender of the persistent event is considered a sender of the corresponding command. That means one can respond to sender from within an event handler. Within an event handler, applications usually update persistent actor state using persisted event data, notify listeners and reply to command senders. If persistence of an event fails, OnPersistFailure(Exception, Object, Int64) will be invoked and the actor will unconditionally be stopped. The reason that it cannot resume when persist fails is that it is unknown if the event was actually persisted or not, and therefore it is in an inconsistent state. Restarting on persistent failures will most likely fail anyway, since the journal is probably unavailable. It is better to stop the actor and after a back-off timeout start it again.
(Inherited from Eventsourced.)
Public methodPersistAllTEvent (Inherited from Eventsourced.)
Public methodPersistAllAsyncTEvent (Inherited from Eventsourced.)
Public methodPersistAsyncTEvent(IEnumerableTEvent, ActionTEvent) Obsolete.
TBD
(Inherited from Eventsourced.)
Public methodPersistAsyncTEvent(TEvent, ActionTEvent)
Asynchronously persists an event. On successful persistence, the handler is called with the persisted event. Unlike PersistTEvent(TEvent, ActionTEvent) method, this one will continue to receive incoming commands between calls and executing it's event handler. This version should be used in favor of PersistTEvent(TEvent, ActionTEvent) method when throughput is more important that commands execution precedence. An event handler may close over eventsourced actor state and modify it. Sender of the persistent event is considered a sender of the corresponding command. That means, one can respond to sender from within an event handler. Within an event handler, applications usually update persistent actor state using persisted event data, notify listeners and reply to command senders. If persistence of an event fails, OnPersistFailure(Exception, Object, Int64) will be invoked and the actor will unconditionally be stopped. The reason that it cannot resume when persist fails is that it is unknown if the event was actually persisted or not, and therefore it is in an inconsistent state. Restarting on persistent failures will most likely fail anyway, since the journal is probably unavailable. It is better to stop the actor and after a back-off timeout start it again.
(Inherited from Eventsourced.)
Protected methodPostRestart
User overridable callback: By default it calls `preStart()`.

Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.

(Inherited from ActorBase.)
Protected methodPostStop
User overridable callback.

Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.

(Inherited from ActorBase.)
Protected methodPreRestart
User overridable callback: '''By default it disposes of all children and then calls `postStop()`.'''

Is called on a crashed Actor right BEFORE it is restarted to allow clean up of resources before Actor is terminated.

(Inherited from ActorBase.)
Protected methodPreStart
User overridable callback.

Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.

(Inherited from ActorBase.)
Protected methodReceive
TBD
(Inherited from PersistentActor.)
Protected methodReceiveCommand
Command handler. Typically validates commands against current state - possibly by communicating with other actors. On successful validation, one or more events are derived from command and persisted.
(Inherited from Eventsourced.)
Protected methodReceiveRecover
Recovery handler that receives persistent events during recovery. If a state snapshot has been captured and saved, this handler will receive a SnapshotOffer message followed by events that are younger than offer itself. This handler must not have side-effects other than changing persistent actor state i.e. it should not perform actions that may fail, such as interacting with external services, for example. If there is a problem with recovering the state of the actor from the journal, the error will be logged and the actor will be stopped.
(Inherited from Eventsourced.)
Public methodSaveSnapshot
Saves snapshot of current ISnapshotter state. The PersistentActor will be notified about the success or failure of this via an SaveSnapshotSuccess or SaveSnapshotFailure message.
(Inherited from Eventsourced.)
Public methodSetDeliverySnapshot
If snapshot from GetDeliverySnapshot was saved it will be received during recovery phase in a SnapshotOffer message and should be set with this method.
Protected methodSetReceiveTimeout

Defines the inactivity timeout after which the sending of a ReceiveTimeout message is triggered. When specified, the receive function should be able to handle a ReceiveTimeout message.

Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after another message was enqueued; hence it is not guaranteed that upon reception of the receive timeout there must have been an idle period beforehand as configured via this method.

Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity periods). Pass in null to switch off this feature.

(Inherited from ActorBase.)
Protected methodSupervisorStrategy
TBD
(Inherited from ActorBase.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Protected methodUnbecome Obsolete.
TBD
(Inherited from ActorBase.)
Protected methodUnbecomeStacked
Reverts the Actor behavior to the previous one on the behavior stack.
(Inherited from ActorBase.)
Protected methodUnhandled
TBD
(Inherited from Eventsourced.)
Top
Fields
  NameDescription
Protected fieldExtension
TBD
(Inherited from Eventsourced.)
Top
Extension Methods
See Also