akka.netakka.net-persistence

Akka.Net SQL server persistence configuration doesn't seem to load


I'm trying to upgrade an existing (demo) project from Akka.Net 1.0.8 to something more recent (1.3.2 or whatever).

I'm stuck on getting the SQL server persistence to load. I've taken the following steps:

  1. Created a blank project, and included the Akka.Persistence.SqlServer package and all of its dependencies
  2. Copied the HOCON configuration example from here:
    • Changed the DB connection strings to an existing DB
    • Set the auto-initialize to 'on'
    • Fixed the double quote issue in akka.persistence.journal-store.sql-server.plugin-dispatcher
  3. Created an Actor System
  4. Inspected the SQL server configuration for the presence of my connection string

Results:

Here is the HOCON configuration I used:

akka.persistence{
journal {
  plugin = "akka.persistence.journal.sql-server"
    sql-server {
        # qualified type name of the SQL Server persistence journal actor
        class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"

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

        # connection string used for database access
        connection-string = "Data Source=(LocalDB)\\MSSQLLocalDB;Initial Catalog=AkkaPersistence;Integrated Security=True"

        # default SQL commands timeout
        connection-timeout = 30s

        # SQL server schema name to table corresponding with persistent journal
        schema-name = dbo

        # SQL server table corresponding with persistent journal
        table-name = EventJournal

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

        # 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 {
  plugin = "akka.persistence.snapshot-store.sql-server"
    sql-server {

        # qualified type name of the SQL Server persistence journal actor
        class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"

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

        # connection string used for database access
        connection-string = "Data Source=(LocalDB)\\MSSQLLocalDB;Initial Catalog=AkkaPersistence;Integrated Security=True"

        # default SQL commands timeout
        connection-timeout = 30s

        # SQL server schema name to table corresponding with persistent journal
        schema-name = dbo

        # SQL server table corresponding with persistent journal
        table-name = SnapshotStore

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

Is there a way to troubleshoot the loading of the loading of the HOCON configuration?


Solution

  • The trouble here is that the SQL used in Akka.Persistence.SqlServer has changed significantly between 1.0.8 and 1.3.2.

    IMHO, drop and recreate the table if it's just a demo app. That's the easiest route.

    Otherwise, you're going to have to write a migration script to transition from the 1.0.8 format to the stable format in 1.3.2: https://github.com/akkadotnet/Akka.Persistence.SqlServer#table-schema