Ejemplo n.º 1
0
  public Boolean isExternalRedelivered() {
    Boolean answer = null;

    // check property first, as the implementation details to know if the message
    // was externally redelivered is message specific, and thus the message implementation
    // could potentially change during routing, and therefore later we may not know if the
    // original message was externally redelivered or not, therefore we store this detail
    // as a exchange property to keep it around for the lifecycle of the exchange
    if (hasProperties()) {
      answer = getProperty(Exchange.EXTERNAL_REDELIVERED, null, Boolean.class);
    }

    if (answer == null) {
      // lets avoid adding methods to the Message API, so we use the
      // DefaultMessage to allow component specific messages to extend
      // and implement the isExternalRedelivered method.
      DefaultMessage msg = getIn(DefaultMessage.class);
      if (msg != null) {
        answer = msg.isTransactedRedelivered();
        // store as property to keep around
        setProperty(Exchange.EXTERNAL_REDELIVERED, answer);
      }
    }

    return answer;
  }