Ejemplo n.º 1
0
 @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);
   }
 }
Ejemplo n.º 2
0
  @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;
  }