C# Class Akka.Persistence.Sql.Common.Journal.JournalDbEngine

Class used to abstract SQL persistence capabilities for concrete implementation of actor journal.
Inheritance: IDisposable
Datei anzeigen Open project: rogeralsing/akka.net Class Usage Examples

Public Properties

Property Type Description
Settings JournalSettings

Protected Properties

Property Type Description
TimestampProvider ITimestampProvider

Public Methods

Method Description
Close ( ) : void

Closes database connection if exists.

CreateDbConnection ( ) : DbConnection
DeleteMessagesToAsync ( string persistenceId, long toSequenceNr ) : Task

Asynchronously deletes all persisted messages identified by provided persistenceId up to provided message sequence number (inclusive).

ReadEvents ( object queryId, IEnumerable hints, IActorRef sender, Action replayCallback ) : Task

Performs

ReadHighestSequenceNrAsync ( string persistenceId, long fromSequenceNr ) : Task

Asynchronously reads a highest sequence number of the event stream related with provided persistenceId.

ReplayMessagesAsync ( string persistenceId, long fromSequenceNr, long toSequenceNr, long max, IActorRef sender, Action recoveryCallback ) : Task

Asynchronously replays all requested messages related to provided persistenceId, using provided sequence ranges (inclusive) with max number of messages replayed (counting from the beginning). Replay callback is invoked for each replayed message.

WriteMessagesAsync ( IEnumerable messages ) : Task>

Asynchronously writes all persistent messages inside SQL Server database. Specific table used for message persistence may be defined through configuration within 'akka.persistence.journal.sql-server' scope with 'schema-name' and 'table-name' keys.

Protected Methods

Method Description
CopyParamsToCommand ( DbCommand sqlCommand, JournalEntry entry ) : void

Copies values from entities to database command.

CreateDbConnection ( string connectionString ) : DbConnection

Initializes a database connection.

GetConnectionString ( ) : string

Returns connection string from either HOCON configuration or <connectionStrings> section of app.config.

JournalDbEngine ( ActorSystem system ) : System

Private Methods

Method Description
CompleteCommand ( DbCommand sqlCommand, DbConnection connection ) : void
CreateTimestampProvider ( ) : ITimestampProvider
IDisposable ( ) : void
InsertInTransactionAsync ( DbCommand sqlCommand, IEnumerable journalEntries ) : Task
ToJournalEntry ( IPersistentRepresentation message ) : JournalEntry
TryUnwrapException ( Exception e ) : Exception

Method Details

Close() public method

Closes database connection if exists.
public Close ( ) : void
return void

CopyParamsToCommand() protected abstract method

Copies values from entities to database command.
protected abstract CopyParamsToCommand ( DbCommand sqlCommand, JournalEntry entry ) : void
sqlCommand System.Data.Common.DbCommand
entry JournalEntry
return void

CreateDbConnection() public method

public CreateDbConnection ( ) : DbConnection
return System.Data.Common.DbConnection

CreateDbConnection() protected abstract method

Initializes a database connection.
protected abstract CreateDbConnection ( string connectionString ) : DbConnection
connectionString string
return System.Data.Common.DbConnection

DeleteMessagesToAsync() public method

Asynchronously deletes all persisted messages identified by provided persistenceId up to provided message sequence number (inclusive).
public DeleteMessagesToAsync ( string persistenceId, long toSequenceNr ) : Task
persistenceId string
toSequenceNr long
return Task

GetConnectionString() protected method

Returns connection string from either HOCON configuration or <connectionStrings> section of app.config.
protected GetConnectionString ( ) : string
return string

JournalDbEngine() protected method

protected JournalDbEngine ( ActorSystem system ) : System
system ActorSystem
return System

ReadEvents() public method

Performs
public ReadEvents ( object queryId, IEnumerable hints, IActorRef sender, Action replayCallback ) : Task
queryId object
hints IEnumerable
sender IActorRef
replayCallback Action
return Task

ReadHighestSequenceNrAsync() public method

Asynchronously reads a highest sequence number of the event stream related with provided persistenceId.
public ReadHighestSequenceNrAsync ( string persistenceId, long fromSequenceNr ) : Task
persistenceId string
fromSequenceNr long
return Task

ReplayMessagesAsync() public method

Asynchronously replays all requested messages related to provided persistenceId, using provided sequence ranges (inclusive) with max number of messages replayed (counting from the beginning). Replay callback is invoked for each replayed message.
public ReplayMessagesAsync ( string persistenceId, long fromSequenceNr, long toSequenceNr, long max, IActorRef sender, Action recoveryCallback ) : Task
persistenceId string Identifier of persistent messages stream to be replayed.
fromSequenceNr long Lower inclusive sequence number bound. Unbound by default.
toSequenceNr long Upper inclusive sequence number bound. Unbound by default.
max long Maximum number of messages to be replayed. Unbound by default.
sender IActorRef
recoveryCallback Action Action invoked for each replayed message.
return Task

WriteMessagesAsync() public method

Asynchronously writes all persistent messages inside SQL Server database. Specific table used for message persistence may be defined through configuration within 'akka.persistence.journal.sql-server' scope with 'schema-name' and 'table-name' keys.
public WriteMessagesAsync ( IEnumerable messages ) : Task>
messages IEnumerable
return Task>

Property Details

Settings public_oe property

Settings applied to journal mapped from HOCON config file.
public JournalSettings Settings
return JournalSettings

TimestampProvider protected_oe property

Timestamp provider used for generation of timestamps for incoming persistent messages.
protected ITimestampProvider TimestampProvider
return ITimestampProvider