Akka.Net SQL 服务器持久性配置似乎没有加载
Akka.Net SQL server persistence configuration doesn't seem to load
我正在尝试将现有(演示)项目从 Akka.Net 1.0.8 升级到更新的版本(1.3.2 或其他版本)。
我无法加载 SQL 服务器持久性。我已采取以下步骤:
- 创建了一个空白项目,并包含了 Akka.Persistence.SqlServer 包及其所有依赖项
- 从here复制了HOCON配置示例:
- 将数据库连接字符串更改为现有数据库
- 设置自动初始化为'on'
- 修复了 akka.persistence.journal-store.sql-server.plugin-dispatcher
中的双引号问题
- 创建了一个 Actor 系统
- 检查了 SQL 服务器配置是否存在我的连接字符串
结果:
- 1.3.2:连接字符串不存在(似乎是默认的后备配置),数据库中没有任何反应
- 1.0.8: 存在连接字符串,配置似乎正确,表是在空数据库中创建的。
这是我使用的HOCON配置:
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
}
}
}
有没有办法解决加载HOCON配置的问题?
这里的麻烦是Akka.Persistence.SqlServer中使用的SQL在1.0.8和1.3.2之间发生了显着变化。
恕我直言,如果它只是一个演示应用程序,请删除并重新创建 table。这是最简单的路线。
否则,您将不得不编写迁移脚本以从 1.0.8 格式过渡到 1.3.2 中的 stable 格式:https://github.com/akkadotnet/Akka.Persistence.SqlServer#table-schema
我正在尝试将现有(演示)项目从 Akka.Net 1.0.8 升级到更新的版本(1.3.2 或其他版本)。
我无法加载 SQL 服务器持久性。我已采取以下步骤:
- 创建了一个空白项目,并包含了 Akka.Persistence.SqlServer 包及其所有依赖项
- 从here复制了HOCON配置示例:
- 将数据库连接字符串更改为现有数据库
- 设置自动初始化为'on'
- 修复了 akka.persistence.journal-store.sql-server.plugin-dispatcher 中的双引号问题
- 创建了一个 Actor 系统
- 检查了 SQL 服务器配置是否存在我的连接字符串
结果:
- 1.3.2:连接字符串不存在(似乎是默认的后备配置),数据库中没有任何反应
- 1.0.8: 存在连接字符串,配置似乎正确,表是在空数据库中创建的。
这是我使用的HOCON配置:
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
}
}
}
有没有办法解决加载HOCON配置的问题?
这里的麻烦是Akka.Persistence.SqlServer中使用的SQL在1.0.8和1.3.2之间发生了显着变化。
恕我直言,如果它只是一个演示应用程序,请删除并重新创建 table。这是最简单的路线。
否则,您将不得不编写迁移脚本以从 1.0.8 格式过渡到 1.3.2 中的 stable 格式:https://github.com/akkadotnet/Akka.Persistence.SqlServer#table-schema