/**
  * Performs a defensive copy of the exchange if needed
  *
  * @param exchange the exchange
  * @return the defensive copy, or <tt>null</tt> if not needed (redelivery is not enabled).
  */
 protected Exchange defensiveCopyExchangeIfNeeded(Exchange exchange) {
   // only do a defensive copy if redelivery is enabled
   if (redeliveryEnabled) {
     return ExchangeHelper.createCopy(exchange, true);
   } else {
     return null;
   }
 }
示例#2
0
 /**
  * Prepares the exchange for the next iteration
  *
  * @param exchange the exchange
  * @param index the index of the next iteration
  * @return the exchange to use
  */
 protected Exchange prepareExchange(Exchange exchange, int index, Exchange original) {
   if (copy) {
     // use a copy but let it reuse the same exchange id so it appear as one exchange
     // use the original exchange rather than the looping exchange (esp. with the async routing
     // engine)
     return ExchangeHelper.createCopy(original, true);
   } else {
     ExchangeHelper.prepareOutToIn(exchange);
     return exchange;
   }
 }