2016-04-15 28 views
0

我正在嘗試用日誌持久性配置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的樣品,我可以檢查以瞭解這是怎麼工作?

回答

1

配置要求爲程序集提供完全限定的類型名稱。嘗試指定類爲"Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb"(您可能不需要雙引號,因爲它不是內聯字符串)。

+1

感謝您的提示......這是有幫助的。但是,我將需要不止一些小建議來構建基於Akka.Net的系統。我需要一些可以學習的很好的示例應用程序。 –