Click or drag to resize
Akka.NETBatchingSqlJournalTConnection, TCommand Class
An abstract journal used by PersistentActors to read/write events to a database. This implementation uses horizontal batching to recycle usage of the DbConnection and to optimize writes made to a database. Batching journal is not going to acquire a new DB connection on every request. Instead it will batch incoming requests and execute them only when a previous operation batch has been completed. This means that requests coming from many actors at the same time will be executed in one batch. Maximum number of batches executed at the same time is defined by MaxConcurrentOperations setting, while max allowed batch size is defined by MaxBatchSize setting. Batching journal also defines MaxBufferSize, which defines a maximum number of all requests stored at once in memory. Once that value is surpassed, journal will start to apply OnBufferOverflow(IJournalMessage) logic on each incoming requests, until a buffer gets freed again. This may be used for overflow strategies, request denials or backpressure.
Inheritance Hierarchy
SystemObject
  Akka.ActorActorBase
    Akka.Persistence.JournalWriteJournalBase
      Akka.Persistence.Sql.Common.JournalBatchingSqlJournalTConnection, TCommand
        Akka.Persistence.Sqlite.JournalBatchingSqliteJournal

Namespace:  Akka.Persistence.Sql.Common.Journal
Assembly:  Akka.Persistence.Sql.Common (in Akka.Persistence.Sql.Common.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public abstract class BatchingSqlJournal<TConnection, TCommand> : WriteJournalBase
where TConnection : DbConnection
where TCommand : DbCommand

Type Parameters

TConnection
A concrete implementation of DbConnection for targeted database provider.
TCommand
A concrete implementation of DbCommand for targeted database provider.

The BatchingSqlJournalTConnection, TCommand type exposes the following members.

Constructors
  NameDescription
Protected methodBatchingSqlJournalTConnection, TCommand
Initializes a new instance of the BatchingSqlJournalTConnection, TCommand class.
Top
Properties
  NameDescription
Protected propertyAllPersistenceIdsSql
SQL query executed as result of GetCurrentPersistenceIds request to journal. It's a part of persistence query protocol.
Protected propertyByPersistenceIdSql
SQL query executed as result of ReplayMessages request to journal. It's also part of persistence query protocol.
Protected propertyByTagSql
SQL query executed as result of ReplayTaggedMessages request to journal. It's a part of persistence query protocol.
Protected propertyDeleteBatchSql
SQL query executed as result of DeleteMessagesTo request to journal.
Protected propertyHasAllIdsSubscribers
Flag determining if current journal has any subscribers for GetCurrentPersistenceIds and PersistenceIdAdded messages.
Protected propertyHasPersistenceIdSubscribers
Flag determining if current journal has any subscribers for EventAppended events.
Protected propertyHasTagSubscribers
Flag determining if current journal has any subscribers for TaggedEventAppended events.
Protected propertyHighestSequenceNrSql
SQL query executed as result of ReadHighestSequenceNr(String, TCommand) request to journal. Also used under some conditions, when storing metadata upon DeleteMessagesTo request.
Protected propertyInitializers
A named collection of SQL statements to be executed once journal actor gets initialized and the AutoInitialize flag is set.
Protected propertyInsertEventSql
SQL statement executed as result of WriteMessages request to journal.
Protected propertySelf
Gets the self ActorRef
(Inherited from ActorBase.)
Protected propertySender
Gets the sending ActorRef of the current message
(Inherited from ActorBase.)
Protected propertySetup
All configurable settings defined for a current batching journal.
Protected propertyUpdateSequenceNrSql
SQL statement executed as result of writing metadata, which is a possible effect of DeleteMessagesTo request.
Top
Methods
  NameDescription
Protected methodAdaptFromJournal
TBD
(Inherited from WriteJournalBase.)
Protected methodAdaptToJournal
TBD
(Inherited from WriteJournalBase.)
Protected methodAddParameter
Helper method used to add a parameter to existing database command.
Public methodAroundPostRestart
Can be overridden to intercept calls to `PostRestart`. Calls `PostRestart` by default.
(Inherited from ActorBase.)
Public methodAroundPostStop
Can be overridden to intercept calls to `PostStop`. Calls `PostStop` by default..
(Inherited from ActorBase.)
Public methodAroundPreRestart
Can be overridden to intercept calls to `PreRestart`. Calls `PreRestart` by default.
(Inherited from ActorBase.)
Public methodAroundPreStart
Can be overridden to intercept calls to `PreStart`. Calls `PreStart` by default.
(Inherited from ActorBase.)
Protected methodAroundReceive
TBD
(Inherited from ActorBase.)
Protected methodBatchRequest
Tries to add incoming message to Buffer. Also checks if any DB connection has been released and next batch can be processed.
Protected methodBecome
Changes the actor's command behavior and replaces the current receive handler with the specified handler.
(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.)
Protected methodCreateConnection
Creates a new database connection from a given connectionString.
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 methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodHandleDeleteMessagesTo
Protected methodHandleReplayMessages
Protected methodHandleReplayTaggedMessages
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodNotifyNewPersistenceIdAdded
Protected methodOnBufferOverflow
Method called, once given request couldn't be added to Buffer due to buffer overflow. Overflow is controlled by max buffer size and can be set using MaxBufferSize setting.
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 methodPreparePersistentBatch
TBD
(Inherited from WriteJournalBase.)
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
TBD
(Overrides ActorBasePreStart.)
Protected methodReadEvent
Returns a persistent representation of an event read from a current row in the database.
Protected methodReadHighestSequenceNr
Protected methodReceive
TBD
(Overrides ActorBaseReceive(Object).)
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 methodUnbecomeStacked
Reverts the Actor behavior to the previous one on the behavior stack.
(Inherited from ActorBase.)
Protected methodUnhandled
Is called when a message isn't handled by the current behavior of the actor by default it fails with either a DeathPactException (in case of an unhandled Terminated message) or publishes an UnhandledMessage to the actor's system's EventStream
(Inherited from ActorBase.)
Protected methodWriteEvent
Perform write of persistent event with specified tags into database using given command.
Top
Fields
  NameDescription
Protected fieldBuffer
Buffer for requests that are waiting to be served when next DB connection will be released. This object access is NOT thread safe.
Protected fieldCanPublish
Flag determining if incoming journal requests should be published in current actor system event stream. Useful mostly for tests.
Protected fieldStatic memberIsDeletedIndex
Default index of IsDeleted column get from ByPersistenceIdSql query.
Protected fieldLog
Logging adapter for current journal actor .
Protected fieldStatic memberManifestIndex
Default index of Manifest column get from ByPersistenceIdSql query.
Protected fieldStatic memberOrderingIndex
Default index of tags column get from ByTagSql query.
Protected fieldStatic memberPayloadIndex
Default index of Payload column get from ByPersistenceIdSql query.
Protected fieldStatic memberPersistenceIdIndex
Default index of PersistenceId column get from ByPersistenceIdSql query.
Protected fieldStatic memberSequenceNrIndex
Default index of SequenceNr column get from ByPersistenceIdSql query.
Top
Extension Methods
See Also