@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);
   }
 }
Esempio n. 2
0
  private List<Map<String, Object>> executeQuery(Exchange exchange) throws Exception {
    String query = ExchangeHelper.getMandatoryInBody(exchange, String.class);
    boolean retrieveContent =
        exchange
            .getIn()
            .getHeader(CamelCMISConstants.CAMEL_CMIS_RETRIEVE_CONTENT, false, Boolean.class);
    int readSize =
        exchange.getIn().getHeader(CamelCMISConstants.CAMEL_CMIS_READ_SIZE, 0, Integer.class);

    ItemIterable<QueryResult> itemIterable = cmisSessionFacade.executeQuery(query);
    return cmisSessionFacade.retrieveResult(retrieveContent, readSize, itemIterable);
  }
  public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
    InputStream is = ExchangeHelper.getMandatoryInBody(exchange, InputStream.class);
    GZIPInputStream unzipInput = new GZIPInputStream(is);

    // Create an expandable byte array to hold the inflated data
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
      IOHelper.copy(unzipInput, bos);
      return bos.toByteArray();
    } finally {
      IOHelper.close(unzipInput);
    }
  }