@Override public ScopeDescriptor describeScope() { return new AggregateScopeDescriptor(type(), this::identifier); }
/** * This function is provided for Java serialization, such that it will ensure the {@code identifierSupplier} is * called, thus setting the {@code identifier}, prior to serializing this AggregateScopeDescriptor. */ private void writeObject(java.io.ObjectOutputStream out) throws IOException { getIdentifier(); out.defaultWriteObject(); }
@Override public boolean canResolve(ScopeDescriptor scopeDescription) { return scopeDescription instanceof AggregateScopeDescriptor && Objects.equals(type.getSimpleName(), ((AggregateScopeDescriptor) scopeDescription).getType()); } }
@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); } } }
@Override public boolean canResolve(ScopeDescriptor scopeDescription) { return scopeDescription instanceof AggregateScopeDescriptor && Objects.equals(aggregateModel.type(), ((AggregateScopeDescriptor) scopeDescription).getType()); } }
@Override public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (canResolve(scopeDescription)) { String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString(); load(aggregateIdentifier).handle(message); } }
@Override public boolean canResolve(ScopeDescriptor scopeDescription) { return scopeDescription instanceof AggregateScopeDescriptor && Objects.equals(model.type(), ((AggregateScopeDescriptor) scopeDescription).getType()); } }
String aggregateIdentifier = ((AggregateScopeDescriptor) scopeDescription).getIdentifier().toString();