@Handler @Transactional @Override public void handle(Exchange exchange) throws InvalidPayloadException { Receipt receipt = ExchangeHelper.getMandatoryInBody(exchange, Receipt.class); if (!updateDatabase(receipt)) { LOG.warn( "Could not find batch for digipostBatchId='{}'. Stopping route.", receipt.getRefJobbId()); exchange.setProperty(Exchange.ROUTE_STOP, true); } }
@Override public boolean updateDatabase(Receipt receipt) { MessageBatch batch = messageDao.getBatch(receipt.getRefJobbId()); if (batch == null) { return false; } for (Message m : batch.getMessages()) { m.status = receipt.toStatus(m.getRecepientId()); } return true; }