@Override public Object handle(CommandMessage<?> commandMessage) throws Exception { return handlers.stream().filter(eh -> eh.canHandle(commandMessage)) .findFirst() .orElseThrow(() -> new NoHandlerForCommandException(commandMessage)) .handle(commandMessage); }
@Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } }
/** * Resets this entry, preparing it to run given {@code callable} from within the {@code invocationInterceptorChain}. * * @param callable a {@link Callable} which performs a task in the {@code invocationInterceptorChain}, * for example publishing a scheduled {@link org.axonframework.deadline.DeadlineMessage} * @param newInvokerSegmentId The SegmentId of the invoker that should process this entry * @param newPublisherSegmentId The SegmentId of the publisher that should process this entry * @param newCallback The callback to report the result of command execution to */ public void resetAsCallable(Callable<Object> callable, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<Object, Object> newCallback) { this.isRecoverEntry = false; this.invokerSegmentId = newInvokerSegmentId; this.publisherSegmentId = newPublisherSegmentId; this.callback = newCallback; result = null; aggregateIdentifier = null; invocationInterceptorChain = callable::call; publisherInterceptorChain = () -> repeatingCommandHandler.handle(null); reset(null); }
@Override public Object handle(CommandMessage<?> commandMessage) throws Exception { return handlers.get(commandMessage.getCommandName()).handle(commandMessage); }
@Override public Object handle(CommandMessage<?> commandMessage) throws Exception { return handlers.stream().filter(eh -> eh.canHandle(commandMessage)) .findFirst() .orElseThrow(() -> new NoHandlerForCommandException(commandMessage)) .handle(commandMessage); }
@Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } }
@Override public Object proceed() throws Exception { if (chain.hasNext()) { return chain.next().handle(unitOfWork, this); } else { return handler.handle(unitOfWork.getMessage()); } } }
/** * Resets this entry, preparing it to run given {@code callable} from within the {@code invocationInterceptorChain}. * * @param callable a {@link Callable} which performs a task in the {@code invocationInterceptorChain}, * for example publishing a scheduled {@link org.axonframework.deadline.DeadlineMessage} * @param newInvokerSegmentId The SegmentId of the invoker that should process this entry * @param newPublisherSegmentId The SegmentId of the publisher that should process this entry * @param newCallback The callback to report the result of command execution to */ public void resetAsCallable(Callable<Object> callable, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<Object, Object> newCallback) { this.isRecoverEntry = false; this.invokerSegmentId = newInvokerSegmentId; this.publisherSegmentId = newPublisherSegmentId; this.callback = newCallback; result = null; exceptionResult = null; aggregateIdentifier = null; invocationInterceptorChain = callable::call; publisherInterceptorChain = () -> repeatingCommandHandler.handle(null); reset(null); }
/** * Resets this entry, preparing it to run given {@code callable} from within the {@code invocationInterceptorChain}. * * @param callable a {@link Callable} which performs a task in the {@code invocationInterceptorChain}, * for example publishing a scheduled {@link org.axonframework.deadline.DeadlineMessage} * @param newInvokerSegmentId The SegmentId of the invoker that should process this entry * @param newPublisherSegmentId The SegmentId of the publisher that should process this entry * @param newCallback The callback to report the result of command execution to */ public void resetAsCallable(Callable<Object> callable, int newInvokerSegmentId, int newPublisherSegmentId, BlacklistDetectingCallback<Object, Object> newCallback) { this.isRecoverEntry = false; this.invokerSegmentId = newInvokerSegmentId; this.publisherSegmentId = newPublisherSegmentId; this.callback = newCallback; result = null; aggregateIdentifier = null; invocationInterceptorChain = callable::call; publisherInterceptorChain = () -> repeatingCommandHandler.handle(null); reset(null); }