Akka Persistence和Mongodb:重播persistenceId事件时的持久性失败

时间:2016-11-19 11:31:26

标签: mongodb scala runtime-error akka-persistence

我使用这个https://github.com/ironfish/akka-persistence-mongo/ mongodb插件与mongodb进行了akka-persistence。当我运行我的代码时,我收到以下错误:

[ERROR] [11/19/2016 16:47:29.355] [transaction-system-akka.actor.default-dispatcher-5] [akka://transaction-system/user/$a] Persistence failure when replaying events for persistenceId [balanceTransactions]. Last known sequence number [0] (akka.persistence.RecoveryTimedOut)

我没有得到,这个错误是什么意思,我该如何解决这个错误。以下是我的reference.conf文件:

akka {
  persistence {
    journal {
      plugin = "casbah-snapshot"
    }
    snapshot-store {
      plugin = "casbah-snapshot"
    }
  }
}

casbah-snapshot {
  mongo-url = "mongodb://localhost:27017/user.events"
  woption = 1
  wtimeout = 10000
  load-attempts = 5
}

1 个答案:

答案 0 :(得分:0)

更改我的private static final String TAG = "MyPreferences"; private static final String APP_PREFS = "my_prefs"; private static MyPreferences mPreferences; private SharedPreferences mPreferences; private Editor mEditor; private Context mContext; private MyPreferences(Context context) { mContext = context; mPreferences = context.getSharedPreferences(APP_PREFS, Context.MODE_PRIVATE); mEditor = mPreferences.edit(); } public static MyPreferences getInstance(Context context) { if (mPreferences == null) { mPreferences = new MyPreferences(context); } return mPreferences; } public void removeKey(String key) { mEditor.remove(key).apply(); } public void clear() { mEditor.clear().commit(); ciaoPreferences = null; } public AppState getAppState() { String state = mPreferences.getString(PREFS_APP_STATE, AppState.INSTALLED.name()); return AppState.valueOf(state); } public void setAppState(AppState state) { mEditor.putString(PREFS_APP_STATE, state.name()).apply(); } 文件后,我的示例成功运行。以下是有效的reference.conf文件。

reference.conf