@Test @DisplayName("record modification time when command is handled") void recordModificationUponCommandHandled() { try { Timestamp frozenTime = Time.currentTime(); Time.setProvider(new TimeTests.FrozenMadHatterParty(frozenTime)); dispatchCommand(aggregate, command(createProject)); assertEquals(frozenTime, aggregate.whenModified()); } finally { Time.resetProvider(); } }
@Override protected DispatchOutcome dispatchCommand(CommandEnvelope command) { Optional<Error> error = idempotencyGuard.check(command); if (error.isPresent()) { DispatchOutcome outcome = DispatchOutcome .newBuilder() .setPropagatedSignal(command.messageId()) .setError(error.get()) .vBuild(); return outcome; } else { CommandHandlerMethod method = thisClass().handlerOf(command.messageClass()); DispatchOutcome outcome = method.invoke(this, command); return outcome; } }
Aggregate extends CommandHandlingEntity<I, S, B> implements EventPlayer, EventReactor { @Override protected DispatchOutcome dispatchCommand(CommandEnvelope command) { Optional<Error> error = idempotencyGuard.check(command); if (error.isPresent()) { DispatchOutcome outcome = DispatchOutcome .newBuilder() .setPropagatedSignal(command.messageId()) .setError(error.get()) .vBuild(); return outcome; } else { CommandHandlerMethod method = thisClass().handlerOf(command.messageClass()); DispatchOutcome outcome = method.invoke(this, command); return outcome; } } }
Aggregate extends CommandHandlingEntity<I, S, B> implements EventPlayer, EventReactor { @Override protected DispatchOutcome dispatchCommand(CommandEnvelope command) { Optional<Error> error = idempotencyGuard.check(command); if (error.isPresent()) { DispatchOutcome outcome = DispatchOutcome .newBuilder() .setPropagatedSignal(command.messageId()) .setError(error.get()) .vBuild(); return outcome; } else { CommandHandlerMethod method = thisClass().handlerOf(command.messageClass()); DispatchOutcome outcome = method.invoke(this, command); return outcome; } } protected  Aggregate(); protected  Aggregate(I id); }
Aggregate extends CommandHandlingEntity<I, S, B> implements EventPlayer, EventReactor { @Override protected DispatchOutcome dispatchCommand(CommandEnvelope command) { Optional<Error> error = idempotencyGuard.check(command); if (error.isPresent()) { DispatchOutcome outcome = DispatchOutcome .newBuilder() .setPropagatedSignal(command.messageId()) .setError(error.get()) .vBuild(); return outcome; } else { CommandHandlerMethod method = thisClass().handlerOf(command.messageClass()); DispatchOutcome outcome = method.invoke(this, command); return outcome; } } protected  Aggregate(); protected  Aggregate(I id); @Override final BatchDispatchOutcome play(Iterable<Event> events); }
Aggregate extends CommandHandlingEntity<I, S, B> implements EventPlayer, EventReactor { @Override protected DispatchOutcome dispatchCommand(CommandEnvelope command) { Optional<Error> error = idempotencyGuard.check(command); if (error.isPresent()) { DispatchOutcome outcome = DispatchOutcome .newBuilder() .setPropagatedSignal(command.messageId()) .setError(error.get()) .vBuild(); return outcome; } else { CommandHandlerMethod method = thisClass().handlerOf(command.messageClass()); DispatchOutcome outcome = method.invoke(this, command); return outcome; } } protected  Aggregate(); protected  Aggregate(I id); @Override final BatchDispatchOutcome play(Iterable<Event> events);  }