/** * Sends a batch of messages to the registered <code>AsyncEventListener</code>s. * * @param events The <code>List</code> of events to send * */ protected boolean dispatchBatch(List events) throws GatewaySenderException { if (events.isEmpty()) { return true; } int batchId = this.eventProcessor.getBatchId(); boolean successAll = true; try { for (AsyncEventListener listener : this.eventListeners) { boolean successOne = listener.processEvents(events); if (!successOne) { successAll = false; } } } catch (Exception e) { final String alias = "%s: Exception during processing batch %s"; final Object[] aliasArgs = new Object[] {this, Integer.valueOf(batchId)}; String exMsg = String.format(alias, aliasArgs); GatewaySenderException ge = new GatewaySenderException(exMsg, e); logger.warn(exMsg, ge); throw ge; } return successAll; }