@Override public void execute(@Nonnull Runnable command) { actorSystem.dispatcher().execute(command); }
@Override public void execute(@Nonnull Runnable command) { actorSystem.dispatcher().execute(command); }
@Override public void execute(Runnable runnable) { actorSystem.dispatcher().execute(runnable); }
@Override public void execute(@Nonnull Runnable command) { actorSystem.dispatcher().execute(command); }
@Override public void execute(@Nonnull Runnable command) { actorSystem.dispatcher().execute(command); }
@Override public void execute(Runnable runnable) { actorSystem.dispatcher().execute(runnable); }
@Override public void execute(Runnable runnable) { actorSystem.dispatcher().execute(runnable); }
@Override public void execute(Runnable runnable) { actorSystem.dispatcher().execute(runnable); }
@Override public void onReceive(final Object event) throws Exception { if (event != null && handler.handles(event.getClass())) { getContext().dispatcher().execute(new Runnable() { @Override public void run() { try { handler.handle(event); } catch (Exception e) { e.printStackTrace(); } } }); } }
@Override public void saveSnapshot() { final String simpleName = getClass().getSimpleName(); log.info("{} Saving snapshot for event {}", simpleName, latestJournalidReceived); final byte[] data = serializeData(); log.info("{} serialized data, storing to db", simpleName); context().dispatcher().execute(() -> { try { MongoCollection<Document> collection = mongodatabase.getCollection("snapshot"); if (latestJournalidReceived != null) { final String fileid = UUID.randomUUID().toString(); collection.updateOne(new Document("_id", getId()), new Document("$set", new Document("jid", latestJournalidReceived).append("dataVersion", getSnapshotDataVersion()).append("projectionId", simpleName).append("fileid", fileid)), new UpdateOptions().upsert(true)); saveDataToGridFS(data, fileid); log.info("{} Saved snapshot for event {}", simpleName, latestJournalidReceived); } } catch (Exception e) { log.error("Failed to write snapshot", e); } }); }
@Override public void saveSnapshot() { final String simpleName = getClass().getSimpleName(); log.info("{} Saving snapshot for event {}", simpleName, latestJournalidReceived); final byte[] data = serializeData(); log.info("{} serialized data, storing to db", simpleName); context().dispatcher().execute(() -> { try { MongoCollection<Document> collection = mongodatabase.getCollection("snapshot"); if (latestJournalidReceived != 0) { final String fileid = UUID.randomUUID().toString(); collection.updateOne(new Document("_id", getId()), new Document("$set", new Document("jid", latestJournalidReceived).append("dataVersion", getSnapshotDataVersion()).append("projectionId", simpleName).append("fileid", fileid)), new UpdateOptions().upsert(true)); saveDataToGridFS(data, fileid); log.info("{} Saved snapshot for event {}", simpleName, latestJournalidReceived); } } catch (Exception e) { log.error("Failed to write snapshot", e); } }); }