diff --git a/thoth-core/src/main/java/fr/maif/eventsourcing/EventProcessorImpl.java b/thoth-core/src/main/java/fr/maif/eventsourcing/EventProcessorImpl.java index 01ac3aa7..40965ba3 100644 --- a/thoth-core/src/main/java/fr/maif/eventsourcing/EventProcessorImpl.java +++ b/thoth-core/src/main/java/fr/maif/eventsourcing/EventProcessorImpl.java @@ -83,6 +83,9 @@ public int hashCode() { @Override public CompletionStage>>>> batchProcessCommand(TxCtx ctx, List commands) { + if (commands.isEmpty()) { + return CompletionStages.completedStage(new InTransactionResult<>(List.empty(), () -> CompletionStages.completedStage(Tuple.empty()))); + } // Collect all states from db return aggregateStore.getAggregates(ctx, commands.filter(Command::hasId).map(c -> c.entityId().get())) .thenCompose(states ->