@Override
public Map<AggregateId, List<Event>> getEvents(EventTypeMatcher matcher, String aggregateType, Collection<UUID> aggregateIds, TimeRange timeRange) {
Function<String, Optional<Event>> deserialiser = eventJson -> EventJson.fromString(eventJson, matcher, objectMapper);
Pipeline pipeline = jedis.pipelined();
final Map<AggregateId, Response<Set<String>>> responses = aggregateIds.stream()
.map(id -> AggregateId.of(aggregateType, id))
.collect(toMap(
Function.identity(),
id -> pipeline.smembers(id.toString())));
pipeline.sync();
return responses.entrySet().stream()
.collect(toMap(
Entry::getKey,
e -> deserialiseAll(timeRange, deserialiser, e.getValue().get())));
}
}