Akka.Persistence.MySql 1.5.13

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Akka.Persistence.MySql --version 1.5.13
NuGet\Install-Package Akka.Persistence.MySql -Version 1.5.13
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Akka.Persistence.MySql" Version="1.5.13" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Akka.Persistence.MySql --version 1.5.13
#r "nuget: Akka.Persistence.MySql, 1.5.13"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Akka.Persistence.MySql as a Cake Addin
#addin nuget:?package=Akka.Persistence.MySql&version=1.5.13

// Install Akka.Persistence.MySql as a Cake Tool
#tool nuget:?package=Akka.Persistence.MySql&version=1.5.13

Akka.Persistence.MySql Build status

Akka Persistence journal and snapshot store backed by MySql database.

WARNING: Akka.Persistence.MySql plugin is still in beta and it's mechanics described below may be still subject to change.

Configuration

Both journal and snapshot store share the same configuration keys (however they resides in separate scopes, so they are defined distinctly for either journal or snapshot store):

Remember that connection string must be provided separately to Journal and Snapshot Store.

Example connection-string:

akka.persistence.journal.mysql.connection-string = "Server=localhost;Port=3306;Database=somedb;Uid=someuser;Pwd=somepassword;"
akka.persistence.snapshot-store.mysql.connection-string = "Server=localhost;Port=3306;Database=somedb;Uid=someuser;Pwd=somepassword;"

All config options:

akka.persistence{
  journal {
    plugin = "akka.persistence.journal.mysql"
    mysql {
      # qualified type name of the MySql persistence journal actor
      class = "Akka.Persistence.MySql.Journal.MySqlJournal, Akka.Persistence.MySql"

      # dispatcher used to drive journal actor
      plugin-dispatcher = "akka.actor.default-dispatcher"

      # connection string used for database access
      connection-string = ""

      # connection string name for .config file used when no connection string has been provided
      connection-string-name = ""

      # default MySql commands timeout
      connection-timeout = 30s

      # MySql table corresponding with persistent journal
      table-name = "event_journal"

      # should corresponding journal table be initialized automatically
      auto-initialize = off

      # timestamp provider used for generation of journal entries timestamps
      timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"

      # metadata table
      metadata-table-name = "metadata"

      # default serializer to use
      default-serializer = ""
    }
  }

  snapshot-store {
    plugin = "akka.persistence.snapshot-store.mysql"
    mysql {
      # qualified type name of the MySql persistence journal actor
      class = "Akka.Persistence.MySql.Snapshot.MySqlSnapshotStore, Akka.Persistence.MySql"

      # dispatcher used to drive journal actor
      plugin-dispatcher = "akka.actor.default-dispatcher"

      # connection string used for database access
      connection-string = ""

      # connection string name for .config file used when no connection string has been provided
      connection-string-name = ""

      # default MySql commands timeout
      connection-timeout = 30s

      # MySql table corresponding with persistent journal
      table-name = "snapshot_store"

      # should corresponding journal table be initialized automatically
      auto-initialize = off

      # default serializer to use
      default-serializer = ""
    }
  }
}

Table Schema

SQL Server persistence plugin defines a default table schema used for journal, snapshot store and metadate table.

CREATE TABLE IF NOT EXISTS journal (
  ordering BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  persistence_id VARCHAR(255) NOT NULL,
  sequence_nr BIGINT NOT NULL,
  is_deleted BIT NOT NULL,
  manifest VARCHAR(500) NOT NULL,
  created_at BIGINT NOT NULL,
  payload LONGBLOB NOT NULL,
  tags VARCHAR(2000) NULL,
  serializer_id INT,
  UNIQUE (persistence_id, sequence_nr),
  INDEX journal_sequence_nr_idx (sequence_nr),
  INDEX journal_created_at_idx (created_at)
);

CREATE TABLE IF NOT EXISTS snapshot (
  persistence_id VARCHAR(255) NOT NULL,
  sequence_nr BIGINT NOT NULL,
  created_at BIGINT NOT NULL,
  manifest VARCHAR(255) NOT NULL,
  snapshot LONGBLOB NOT NULL,
  serializer_id INT,
  PRIMARY KEY (persistence_id, sequence_nr),
  INDEX snapshot_sequence_nr_idx (sequence_nr),
  INDEX snapshot_created_at_idx (created_at)
);

CREATE TABLE IF NOT EXISTS metadata (
  persistence_id VARCHAR(255) NOT NULL,
  sequence_nr BIGINT NOT NULL,
  PRIMARY KEY (persistence_id, sequence_nr)
);

Migration

All migration scripts should be tested before running in production!

From 1.0.0-beta to 1.0.0-beta2
/* Update journal table */
ALTER TABLE journal drop primary key;
ALTER TABLE journal ADD COLUMN serializer_id INT;
ALTER TABLE journal ADD COLUMN ordering BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY;
CREATE UNIQUE INDEX journal_persistence_sequence_nr ON journal (persistence_id, sequence_nr);
ALTER TABLE journal CHANGE COLUMN tags tags VARCHAR(2000);
ALTER TABLE journal CHANGE COLUMN payload payload LONGBLOB;

/* Update snapshot table */
ALTER TABLE snapshot CHANGE COLUMN snapshot snapshot LONGBLOB;
ALTER TABLE snapshot ADD COLUMN serializer_id INT;
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.13 218 9/27/2023
1.5.4.1 1,675 4/25/2023
1.5.4 160 4/25/2023
1.5.3 187 4/21/2023
1.5.0 347 3/7/2023
1.4.42 988 9/23/2022
1.4.35 671 3/24/2022
1.4.32 473 1/19/2022
1.4.31 295 12/23/2021
1.0.0 2,314 9/27/2017
1.0.0-beta2 841 9/11/2017
1.0.0-beta 1,007 7/21/2016