Giter Site home page Giter Site logo

dlpc / akka.persistence.mysql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akkadotnet/akka.persistence.mysql

0.0 2.0 0.0 1.12 MB

MySQL implementation for Akka.Persistence

License: Apache License 2.0

Batchfile 1.14% F# 24.86% Shell 1.32% C# 72.67%

akka.persistence.mysql's Introduction

Akka.Persistence.MySql

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 definied distinctly for either journal or snapshot store):

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

akka.persistence{
	journal {
		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 = ""

			# default SQL 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
		}
	}

	snapshot-store {
		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 = ""

			# default SQL 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
		}
	}
}

Table Schema

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

CREATE TABLE IF NOT EXISTS {your_journal_table_name} (
    persistence_id VARCHAR(255) NOT NULL,
    sequence_nr BIGINT NOT NULL,
    is_deleted BIT NOT NULL,
    created_at BIGINT NOT NULL,
    manifest VARCHAR(500) NOT NULL,
    payload BLOB NOT NULL,
    PRIMARY KEY (persistence_id, sequence_nr),
    INDEX {your_journal_table_name}_sequence_nr_idx (sequence_nr),
    INDEX {your_journal_table_name}_created_at_idx (created_at)
);

CREATE TABLE IF NOT EXISTS {your_snapshot_table_name} (
    persistence_id VARCHAR(255) NOT NULL,
    sequence_nr BIGINT NOT NULL,
    created_at BIGINT NOT NULL,
    manifest VARCHAR(500) NOT NULL,
    snapshot BLOB NOT NULL,
    PRIMARY KEY (persistence_id, sequence_nr),
    INDEX {your_snapshot_table_name}_sequence_nr_idx (sequence_nr),
    INDEX {your_snapshot_table_name}_created_at_idx (created_at)
);

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.