我使用了配置为 sql server 插件的持久性actor。下面是我的 hocon 配置。
这里数据源连接字符串设置为我的本地主机。
是否可以在演员系统初始化之前从 C# 代码中设置此连接字符串?
akka.persistence {
journal {
plugin = "akka.persistence.journal.sql-server"
sql-server {
class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"
plugin-dispatcher = "akka.actor.default-dispatcher"
# connection string used for database access
connection-string = "Data Source=ES-NB-046\\MSSQLSERVER_2014;Initial Catalog=SwedolTest;User ID=sa;Password=aaaaaa@;"
# can alternativly specify: connection-string-name
# default SQL timeout
connection-timeout = 30s
# SQL server schema name
schema-name = dbo
# persistent journal table name
table-name = EventJournal
# initialize journal table automatically
auto-initialize = on
timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
metadata-table-name = Metadata
}
}
snapshot-store {
plugin = "akka.persistence.snapshot-store.sql-server"
sql-server {
class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"
plugin-dispatcher = "akka.actor.default-dispatcher"
table-name = SnapshotStore
schema-name = dbo
auto-initialize = on
connection-string = "Data Source=ES-NB-046\\MSSQLSERVER_2014;Initial Catalog=SwedolTest;User ID=sa;Password=aaaaaa@;"
}
}
}