@Test void testCacheEntryInvalidatedOnRecoveryEntry() { commandHandlingEntry.resetAsRecoverEntry(aggregateIdentifier); testSubject.onEvent(commandHandlingEntry, 0, true); verify(mockCache).remove(aggregateIdentifier); verify(mockEventStore, never()).readEvents(eq(aggregateIdentifier)); }
@Override public void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch) { if (entry.isRecoverEntry()) { removeEntry(entry.getAggregateIdentifier()); } else if (entry.getInvokerId() == segmentId) { entry.start(); try { Object result = entry.getInvocationInterceptorChain().proceed(); entry.setResult(asCommandResultMessage(result)); } catch (Exception throwable) { entry.setResult(asCommandResultMessage(throwable)); } finally { entry.pause(); } } }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @Override public void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch) { if (entry.isRecoverEntry()) { removeEntry(entry.getAggregateIdentifier()); } else if (entry.getInvokerId() == segmentId) { entry.start(); try { Object result = entry.getInvocationInterceptorChain().proceed(); entry.setResult(asCommandResultMessage(result)); } catch (Exception throwable) { entry.setResult(asCommandResultMessage(throwable)); } finally { entry.pause(); } } } }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @Override public void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch) { if (entry.isRecoverEntry()) { removeEntry(entry.getAggregateIdentifier()); } else if (entry.getInvokerId() == segmentId) { entry.start(); try { Object result = entry.getInvocationInterceptorChain().proceed(); entry.setResult(asCommandResultMessage(result)); } catch (Exception throwable) { entry.setResult(asCommandResultMessage(throwable)); } finally { entry.pause(); } } } CommandHandlerInvoker(Cache cache, int segmentId); }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @Override public void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch) { if (entry.isRecoverEntry()) { removeEntry(entry.getAggregateIdentifier()); } else if (entry.getInvokerId() == segmentId) { entry.start(); try { Object result = entry.getInvocationInterceptorChain().proceed(); entry.setResult(asCommandResultMessage(result)); } catch (Exception throwable) { entry.setResult(asCommandResultMessage(throwable)); } finally { entry.pause(); } } } CommandHandlerInvoker(Cache cache, int segmentId); @SuppressWarnings("unchecked") static DisruptorRepository<T> getRepository(Class<?> type); @Override void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              RepositoryProvider repositoryProvider,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); @Override void onStart(); @Override void onShutdown(); }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @Override public void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch) { if (entry.isRecoverEntry()) { removeEntry(entry.getAggregateIdentifier()); } else if (entry.getInvokerId() == segmentId) { entry.start(); try { Object result = entry.getInvocationInterceptorChain().proceed(); entry.setResult(asCommandResultMessage(result)); } catch (Exception throwable) { entry.setResult(asCommandResultMessage(throwable)); } finally { entry.pause(); } } } CommandHandlerInvoker(Cache cache, int segmentId); @SuppressWarnings("unchecked") static DisruptorRepository<T> getRepository(Class<?> type); @Override void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              RepositoryProvider repositoryProvider,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); @Override void onStart(); @Override void onShutdown();  }