是否有Akka.net持久性与MongoDb在那里的工作示例?

问题描述:

我正在尝试用日志持久性配置Akka.Net到MongoDb,但它引发了一个我无法弄清楚的异常。 有没有一个参考例子可以在任何地方看到,看看它应该如何工作?我会期望在单元测试中的例子来填补我的这个需求,但是对于MongoDb持久性实现缺少测试。 :(是否有Akka.net持久性与MongoDb在那里的工作示例?

下面是我收到的错误:

Akka.Actor.ActorInitializationException : Exception during creation ---> 
System.TypeLoadException : Method 'ReplayMessagesAsync' in type 
'Akka.Persistence.MongoDb.Journal.MongoDbJournal' from assembly 
'Akka.Persistence.MongoDb, Version=1.0.5.2, Culture=neutral, PublicKeyToken=null' 
does not have an implementation. 

这里是我为这个应用程序HOCON: ---编辑 - 谢谢你的提示Horusiath;基于我更新到这个HOCON和SQLite的提供者的作品,但MongoDB的一个仍然给了一个错误

<![CDATA[ 
    akka { 
     actor { 
      provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote" 
     } 
     remote { 
      helios.tcp { 
       port = 9870 #bound to a specific port 
       hostname = localhost 
      } 
     } 
     persistence { 
      publish-plugin-commands = on 
      journal { 
       #plugin = "akka.persistence.journal.sqlite" 
       plugin = "akka.persistence.journal.mongodb" 
       mongodb { 
        class = "Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb" 
        connection-string = "mongodb://localhost/Akka" 
        collection = "EventJournal" 
       } 
       sqlite { 
        class = "Akka.Persistence.Sqlite.Journal.SqliteJournal, Akka.Persistence.Sqlite" 
        plugin-dispatcher = "akka.actor.default-dispatcher" 
        connection-string = "FullUri=file:Sqlite-journal.db?cache=shared;" 
        connection-timeout = 30s 
        schema-name = dbo 
        table-name = event_journal 
        auto-initialize = on 
        timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common" 
       } 
      } 
      snapshot-store { 
       #plugin = "akka.persistence.snapshot-store.sqlite" 
       plugin = "akka.persistence.snapshot-store.mongodb" 
       mongodb { 
        class = "Akka.Persistence.MongoDb.Snapshot.MongoDbSnapshotStore, Akka.Persistence.MongoDb" 
        connection-string = "mongodb://localhost/Akka" 
        collection = "SnapshotStore" 
       } 
       sqlite { 
          class = "Akka.Persistence.Sqlite.Snapshot.SqliteSnapshotStore, Akka.Persistence.Sqlite" 
          plugin-dispatcher = "akka.actor.default-dispatcher" 
          connection-string = "FullUri=file:Sqlite-journal.db?cache=shared;" 
          connection-timeout = 30s 
          schema-name = dbo 
          table-name = snapshot_store 
          auto-initialize = on 
         } 
       } 
      } 
     } 
    ]]> 
</hocon> 

所以,回到我原来的问题:是否有正在MongoDB的样品,我可以检查以了解这是怎么工作?

配置要求为程序集提供完全限定的类型名称。尝试指定类为"Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb"(您可能不需要双引号,因为它不是内联字符串)。

+1

感谢您的提示......这是有帮助的。但是,我将需要不止一些小建议来构建基于Akka.Net的系统。我需要一些可以学习的很好的示例应用程序。 –