问题描述
当我尝试创建具有sql Server持久性的持久性参与者时,出现上述错误。
编辑:当我克隆存储库akka和akka持久性sql server并附加然后使用nuget包进行连接时,这是什么奇怪的事情,按预期工作。 我正在使用followinf版本: “ Akka” Version =“ 1.4.11” “ Akka.Persistence.sqlServer” Version =“ 1.4.10”
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 = "my con string"
# 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
# Recommended: change default circuit breaker settings
# By uncommenting below and using Connection Timeout + Command Timeout
# circuit-breaker.call-timeout=30s
}
}
snapshot-store {
plugin = "akka.persistence.snapshot-store.sql-server"
sql-server {
# qualified type name of the sql Server persistence journal actor
class = "my con string"
# dispatcher used to drive journal actor
plugin-dispatcher = "akka.actor.default-dispatcher"
# connection string used for database access
connection-string = "xyz"
# 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
# Recommended: change default circuit breaker settings
# By uncommenting below and using Connection Timeout + Command Timeout
# circuit-breaker.call-timeout=30s
}
}
}
}
我的协调员正在尝试根据每个消息ID创建actor,但失败并出现错误:
创建类型的actor实例时出错 具有1个参数的Akka.Persistence.sqlServer.Journal.sqlServerJournal:( 类:“ Akka.Persistence.sqlServer.Journal.sqlServerJournal, Akka.Persistence.sqlServer” plugin-dispatcher:akka.actor.default-dispatcher 连接字符串:“ xyz” 连接超时:30秒 模式名:dbo 表名:EventJournal 自动初始化:开启 timestamp-provider:“ Akka.Persistence.sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.sql.Common” 元数据表名称:元数据 顺序访问:开启 ) 原因:: Akka.Actor.ActorInitializationException:创建期间的异常 ---> System.TypeLoadException:创建类型为Akka.Persistence.sqlServer.Journal.sqlServerJournal的actor实例时出错 有1个参数:(class: “ Akka.Persistence.sqlServer.Journal.sqlServerJournal, Akka.Persistence.sqlServer” plugin-dispatcher:akka.actor.default-dispatcher 连接字符串:“ xyz” 连接超时:30秒 模式名:dbo 表名:EventJournal 自动初始化:开启 timestamp-provider:“ Akka.Persistence.sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.sql.Common” 元数据表名称:元数据 顺序访问:开启 ) ---> System.Reflection.TargetInvocationException:调用的目标已引发异常。 ---> System.MissingMethodException:找不到方法:'Void Akka.Pattern.CircuitBreaker..ctor(Int32,System.TimeSpan, System.TimeSpan)”。 在Akka.Persistence.Journal.AsyncWriteJournal..ctor() 在Akka.Persistence.sql.Common.Journal.sqlJournal..ctor(Config journalConfig) 在Akka.Persistence.sqlServer.Journal.sqlServerJournal..ctor(Config journalConfig)
public class MyCoordinatorActor : ReceiveActor
{
public MyCoordinatorActor ()
{
Receive<MyMessage>(message =>
{
var childName = message.Id.ToString();
var child = Context.Child(childName);
if (child.IsNobody())
{
var props = Props.Create(() => new AuctionActor(childName));
child = Context.ActorOf(props,childName);
}
child.Tell(message);
});
}
}
public class MyActor : ReceivePersistentActor
{
private decimal _currentValue;
public override string PersistenceId { get; }
public AuctionActor(string Id)
{
PersistenceId = Id;
Command<BidMessage>(message =>
{
if (message.Value > _currentValue)
{
Persist(message,mssage =>
{
_currentValue = mssage.Value;
});
}
else
{
}
});
}
}
解决方法
您遇到了这个问题,这是由于我们在Akka.NET v1.4.11:https://github.com/akkadotnet/Akka.Persistence.SqlServer/issues/177
中更改了CircuitBreaker
中的某些API的结果。
几分钟前,我们刚刚推送了Akka.Persistence.SqlServer 1.4.11:https://github.com/akkadotnet/Akka.Persistence.SqlServer/releases/tag/1.4.11-升级到此版本应该可以解决您的问题。