Stack Overflow Asked by TjDillashaw on November 27, 2020
I get above error when I’m trying to create a persisting actor with SQL server persistence.
EDIT: what’s weird when I clone repositories akka and akka persistence sql server and attach then instead using nuget packages is working as expected.
I’m using followinf versions:
"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
}
}
}
}
My coordinator is trying to create actor per message Id but it fails with error:
Error while creating actor instance of type
Akka.Persistence.SqlServer.Journal.SqlServerJournal with 1 args: (
class : "Akka.Persistence.SqlServer.Journal.SqlServerJournal,
Akka.Persistence.SqlServer"
plugin-dispatcher : akka.actor.default-dispatcher
connection-string : "xyz"
connection-timeout : 30s
schema-name : dbo
table-name : EventJournal
auto-initialize : on
timestamp-provider : "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider,
Akka.Persistence.Sql.Common"
metadata-table-name : Metadata
sequential-access : on
)
Cause::
Akka.Actor.ActorInitializationException: Exception during creation
—> System.TypeLoadException: Error while creating actor instance of type Akka.Persistence.SqlServer.Journal.SqlServerJournal
with 1 args: ( class :
"Akka.Persistence.SqlServer.Journal.SqlServerJournal,
Akka.Persistence.SqlServer"
plugin-dispatcher : akka.actor.default-dispatcher
connection-string : "xyz"
connection-timeout : 30s
schema-name : dbo
table-name : EventJournal
auto-initialize : on
timestamp-provider : "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider,
Akka.Persistence.Sql.Common"
metadata-table-name : Metadata
sequential-access : on
)
—> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
—> System.MissingMethodException: Method not found: ‘Void Akka.Pattern.CircuitBreaker..ctor(Int32, System.TimeSpan,
System.TimeSpan)’.
at Akka.Persistence.Journal.AsyncWriteJournal..ctor()
at Akka.Persistence.Sql.Common.Journal.SqlJournal..ctor(Config journalConfig)
at 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
{
}
});
}
}
You ran into this issue, which was the result of us changing some APIs inside the CircuitBreaker
as part of Akka.NET v1.4.11: https://github.com/akkadotnet/Akka.Persistence.SqlServer/issues/177
We just pushed Akka.Persistence.SqlServer 1.4.11 a couple of minutes ago: https://github.com/akkadotnet/Akka.Persistence.SqlServer/releases/tag/1.4.11 - upgrading to this version should resolve your issue.
Correct answer by Aaronontheweb on November 27, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP