public HazelcastEventStore(int maxLogSizePerAggregate, IMap<InstanceId, List<InstanceEvent>> eventLog) { super(maxLogSizePerAggregate, eventLog); eventLog.addEntryListener((MapListener) new EntryAdapter<InstanceId, List<InstanceEvent>>() { @Override public void entryUpdated(EntryEvent<InstanceId, List<InstanceEvent>> event) { log.debug("Updated {}", event); long lastKnownVersion = getLastVersion(event.getOldValue()); List<InstanceEvent> newEvents = event.getValue() .stream() .filter(e -> e.getVersion() > lastKnownVersion) .collect(Collectors.toList()); HazelcastEventStore.this.publish(newEvents); } }, true); }