if (exchange instanceof InOnly) {
// Do not use the fault has it may contain streams
// So just transform it to a string and send an error
String fault = new SourceTransformer().contentToString(me.getFault());
done(me);
fail(exchange, new FaultException(fault, null, null));
} else {
Fault fault = MessageUtil.copyFault(me);
MessageUtil.transferToFault(fault, exchange);
done(me);
sendSync(exchange);
}
} else {
throw new IllegalStateException("Exchange status is " + ExchangeStatus.ACTIVE
+ " but has no correlation set");
}
// Faults must be sent back to the consumer
} else {
if (exchange instanceof InOnly) {
// Do not use the fault has it may contain streams
// So just transform it to a string and send an error
String fault = new SourceTransformer().contentToString(tme.getFault());
done(tme);
fail(exchange, new FaultException(fault, null, null));
} else {
Fault fault = MessageUtil.copyFault(tme);
MessageUtil.transferToFault(fault, exchange);
done(tme);
sendSync(exchange);