Class AtLeastOnceDeliveryReceiveActor
Receive persistent actor type, that sends messages with at-least-once delivery semantics to it's destinations.
Inheritance
Implements
Inherited Members
Namespace: Akka.Persistence
Assembly: Akka.Persistence.dll
Syntax
public abstract class AtLeastOnceDeliveryReceiveActor : ReceivePersistentActor, IInternalActor, IPersistentIdentity, IPersistenceStash, IWithUnboundedStash, IWithUnrestrictedStash, IActorStash, IRequiresMessageQueue<IUnboundedDequeBasedMessageQueueSemantics>, IPersistenceRecovery, IInitializableActor
Constructors
| Improve this Doc View SourceAtLeastOnceDeliveryReceiveActor()
Initializes a new instance of the AtLeastOnceDeliveryReceiveActor class.
Declaration
protected AtLeastOnceDeliveryReceiveActor()
AtLeastOnceDeliveryReceiveActor(PersistenceSettings.AtLeastOnceDeliverySettings)
Initializes a new instance of the AtLeastOnceDeliveryReceiveActor class.
Declaration
protected AtLeastOnceDeliveryReceiveActor(PersistenceSettings.AtLeastOnceDeliverySettings settings)
Parameters
Type | Name | Description |
---|---|---|
PersistenceSettings.AtLeastOnceDeliverySettings | settings | Custom AtLeastOnceDelivery settings |
AtLeastOnceDeliveryReceiveActor(Func<PersistenceSettings.AtLeastOnceDeliverySettings, PersistenceSettings.AtLeastOnceDeliverySettings>)
Initializes a new instance of the AtLeastOnceDeliveryReceiveActor class.
Declaration
protected AtLeastOnceDeliveryReceiveActor(Func<PersistenceSettings.AtLeastOnceDeliverySettings, PersistenceSettings.AtLeastOnceDeliverySettings> overrideSettings)
Parameters
Type | Name | Description |
---|---|---|
Func<PersistenceSettings.AtLeastOnceDeliverySettings, PersistenceSettings.AtLeastOnceDeliverySettings> | overrideSettings | A lambda to tweak the default AtLeastOnceDelivery settings. |
Properties
| Improve this Doc View SourceMaxUnconfirmedMessages
Maximum number of unconfirmed messages, that this actor is allowed to hold in the memory. if this number is exceeded, Deliver(ActorPath, Func<Int64, 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. Custom value may be provided via the AtLeastOnceDeliveryReceiveActor(PersistenceSettings.AtLeastOnceDeliverySettings) constructor.
Declaration
public int MaxUnconfirmedMessages { get; }
Property Value
Type | Description |
---|---|
Int32 |
RedeliverInterval
Interval between redelivery attempts.
The default value can be configure with the 'akka.persistence.at-least-once-delivery.redeliver-interval' configuration key. Custom value may be provided via the AtLeastOnceDeliveryReceiveActor(PersistenceSettings.AtLeastOnceDeliverySettings) constructor.
Declaration
public TimeSpan RedeliverInterval { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
RedeliveryBurstLimit
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. Custom value may be provided via the AtLeastOnceDeliveryReceiveActor(PersistenceSettings.AtLeastOnceDeliverySettings) constructor.
Declaration
public int RedeliveryBurstLimit { get; }
Property Value
Type | Description |
---|---|
Int32 |
UnconfirmedCount
Number of messages that have not been confirmed yet.
Declaration
public int UnconfirmedCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
WarnAfterNumberOfUnconfirmedAttempts
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. Custom value may be provided via the AtLeastOnceDeliveryReceiveActor(PersistenceSettings.AtLeastOnceDeliverySettings) constructor.
Declaration
public int WarnAfterNumberOfUnconfirmedAttempts { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAroundPostStop()
TBD
Declaration
public override void AroundPostStop()
Overrides
| Improve this Doc View SourceAroundPreRestart(Exception, Object)
TBD
Declaration
public override void AroundPreRestart(Exception cause, object message)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | TBD |
Object | message | TBD |
Overrides
| Improve this Doc View SourceAroundReceive(Receive, Object)
TBD
Declaration
protected override bool AroundReceive(Receive receive, object message)
Parameters
Type | Name | Description |
---|---|---|
Receive | receive | TBD |
Object | message | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
Overrides
| Improve this Doc View SourceConfirmDelivery(Int64)
Call this method when a message has been confirmed by the destination, or to abort re-sending.
Declaration
public bool ConfirmDelivery(long deliveryId)
Parameters
Type | Name | Description |
---|---|---|
Int64 | deliveryId | TBD |
Returns
Type | Description |
---|---|
Boolean | True the first time the |
Deliver(ActorPath, Func<Int64, 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.
Declaration
public void Deliver(ActorPath destination, Func<long, object> deliveryMessageMapper)
Parameters
Type | Name | Description |
---|---|---|
ActorPath | destination | TBD |
Func<Int64, Object> | deliveryMessageMapper | TBD |
Exceptions
Type | Condition |
---|---|
MaxUnconfirmedMessagesExceededException | Thrown when UnconfirmedCount is greater than or equal to MaxUnconfirmedMessages. |
Deliver(ActorSelection, Func<Int64, 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.
Declaration
public void Deliver(ActorSelection destination, Func<long, object> deliveryMessageMapper)
Parameters
Type | Name | Description |
---|---|---|
ActorSelection | destination | TBD |
Func<Int64, Object> | deliveryMessageMapper | TBD |
Exceptions
Type | Condition |
---|---|
MaxUnconfirmedMessagesExceededException | Thrown when UnconfirmedCount is greater than or equal to MaxUnconfirmedMessages. |
GetDeliverySnapshot()
Full state of the AtLeastOnceDeliverySemantic. 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.
Declaration
public AtLeastOnceDeliverySnapshot GetDeliverySnapshot()
Returns
Type | Description |
---|---|
AtLeastOnceDeliverySnapshot | TBD |
OnReplaySuccess()
TBD
Declaration
protected override void OnReplaySuccess()
Overrides
| Improve this Doc View SourceSetDeliverySnapshot(AtLeastOnceDeliverySnapshot)
If snapshot from GetDeliverySnapshot() was saved it will be received during recovery phase in a SnapshotOffer message and should be set with this method.
Declaration
public void SetDeliverySnapshot(AtLeastOnceDeliverySnapshot snapshot)
Parameters
Type | Name | Description |
---|---|---|
AtLeastOnceDeliverySnapshot | snapshot | TBD |