@SuppressWarnings("unchecked") @Test void testSendFailsSilentlyOnAggregateNotFoundException() throws Exception { DeadlineMessage<String> testMsg = GenericDeadlineMessage.asDeadlineMessage("deadline-name", "payload", Instant.now()); AggregateScopeDescriptor testDescriptor = new AggregateScopeDescriptor(JpaAggregate.class.getSimpleName(), "some-other-aggregate-id"); testSubject.send(testMsg, testDescriptor); verifyZeroInteractions(spiedAggregate); }
@Override public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); try { load(aggregateIdentifier).handle(message); } catch (AggregateNotFoundException e) { logger.debug("Aggregate (with id: [{}]) cannot be loaded. Hence, message '[{}]' cannot be handled.", aggregateIdentifier, message); } } }
AbstractRepository implements Repository<T> { @Override public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); try { load(aggregateIdentifier).handle(message); } catch (AggregateNotFoundException e) { logger.debug("Aggregate (with id: [{}]) cannot be loaded. Hence, message '[{}]' cannot be handled.", aggregateIdentifier, message); } } } }
AbstractRepository implements Repository<T> { @Override public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); try { load(aggregateIdentifier).handle(message); } catch (AggregateNotFoundException e) { logger.debug("Aggregate (with id: [{}]) cannot be loaded. Hence, message '[{}]' cannot be handled.", aggregateIdentifier, message); } } } protected  AbstractRepository(Builder<T> builder); }
AbstractRepository implements Repository<T> { @Override public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); try { load(aggregateIdentifier).handle(message); } catch (AggregateNotFoundException e) { logger.debug("Aggregate (with id: [{}]) cannot be loaded. Hence, message '[{}]' cannot be handled.", aggregateIdentifier, message); } } } protected  AbstractRepository(Builder<T> builder); @Override A newInstance(Callable<T> factoryMethod); @Override A load(String aggregateIdentifier, Long expectedVersion); @Override Aggregate<T> loadOrCreate(String aggregateIdentifier, Callable<T> factoryMethod); @Override A load(String aggregateIdentifier); @Override void send(Message<?> message, ScopeDescriptor scopeDescription); @Override boolean canResolve(ScopeDescriptor scopeDescription); }
AbstractRepository implements Repository<T> { @Override public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); try { load(aggregateIdentifier).handle(message); } catch (AggregateNotFoundException e) { logger.debug("Aggregate (with id: [{}]) cannot be loaded. Hence, message '[{}]' cannot be handled.", aggregateIdentifier, message); } } } protected  AbstractRepository(Builder<T> builder); @Override A newInstance(Callable<T> factoryMethod); @Override A load(String aggregateIdentifier, Long expectedVersion); @Override Aggregate<T> loadOrCreate(String aggregateIdentifier, Callable<T> factoryMethod); @Override A load(String aggregateIdentifier); @Override void send(Message<?> message, ScopeDescriptor scopeDescription); @Override boolean canResolve(ScopeDescriptor scopeDescription);  }