* Handle a consumer exchange
*/
private void handleConsumerExchange(MessageExchange exchange)
throws MessagingException {
String correlation = (String) exchange.getProperty(DroolsComponent.DROOLS_CORRELATION_ID);
JbiHelper helper = pending.get(correlation);
if (helper != null) {
MessageExchange original = helper.getExchange()
.getInternalExchange();
if (exchange.getStatus() == ExchangeStatus.DONE) {
done(original);
} else if (exchange.getStatus() == ExchangeStatus.ERROR) {
fail(original, exchange.getError());
} else {
if (exchange.getFault() != null) {
MessageUtil.transferFaultToFault(exchange, original);
} else {
MessageUtil.transferOutToOut(exchange, original);
}
send(original);
}
// update the rule engine's working memory to trigger post-done
// rules
helper.update();
} else {
logger.debug("No pending exchange found for "
+ correlation
+ ", no additional rules will be triggered");
}