private boolean invokeHandler(MessageHandler handler, Message<?> message) { try { handler.handleMessage(message); return true; } catch (RuntimeException e) { if (!this.ignoreFailures) { throw e; } else if (this.logger.isWarnEnabled()) { logger.warn("Suppressing Exception since 'ignoreFailures' is set to TRUE.", e); } return false; } }
public void handleMessage(Message<?> message) { if (!this.initialized) { this.afterPropertiesSet(); } this.handlers.get(0).handleMessage(message); }
@Override protected boolean doPoll() { Message<?> message = (this.receiveTimeout >= 0) ? this.inputChannel.receive(this.receiveTimeout) : this.inputChannel.receive(); if (message == null) { return false; } this.handler.handleMessage(message); return true; }
private boolean doDispatch(Message<?> message) { boolean success = false; Iterator<MessageHandler> handlerIterator = this.getHandlerIterator(message); if (!handlerIterator.hasNext()) { throw new MessageDeliveryException(message, "Dispatcher has no subscribers."); } List<RuntimeException> exceptions = new ArrayList<RuntimeException>(); while (success == false && handlerIterator.hasNext()) { MessageHandler handler = handlerIterator.next(); try { handler.handleMessage(message); success = true; // we have a winner. } catch (Exception e) { RuntimeException runtimeException = (e instanceof RuntimeException) ? (RuntimeException) e : new MessageDeliveryException(message, "Dispatcher failed to deliver Message.", e); exceptions.add(runtimeException); this.handleExceptions(exceptions, message, !handlerIterator.hasNext()); } } return success; }