未找到方法:Akka.Pattern.CircuitBreaker.Create

Method not found: Akka.Pattern.CircuitBreaker.Create

当我尝试创建具有 SQL 服务器持久性的持久性 actor 时出现上述错误。

编辑:当我克隆存储库 akka 和 akka 持久性 sql 服务器并附加然后使用 nuget 包按预期工作时,有什么奇怪的。 我正在使用以下版本: “阿卡”版本=“1.4.11” "Akka.Persistence.SqlServer" 版本="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 创建参与者,但失败并出现错误:

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
                {
              
                }

            });
           
        }


    }

您 运行 遇到了这个问题,这是我们在 CircuitBreaker 中更改一些 API 作为 Akka.NET v1.4.11 的一部分的结果:https://github.com/akkadotnet/Akka.Persistence.SqlServer/issues/177

我们刚刚在几分钟前推送了 Akka.Persistence.SqlServer 1.4.11:https://github.com/akkadotnet/Akka.Persistence.SqlServer/releases/tag/1.4.11 - 升级到这个版本应该可以解决您的问题。