*/
protected void processAsync(MessageExchange exchange) throws Exception {
if (exchange.getRole() == MessageExchange.Role.PROVIDER
&& exchange.getProperty(correlation) == null) {
// Create exchange for target
MessageExchange tme = getExchangeFactory().createExchange(exchange.getPattern());
if (store.hasFeature(Store.CLUSTERED)) {
exchange.setProperty(JbiConstants.STATELESS_PROVIDER, Boolean.TRUE);
tme.setProperty(JbiConstants.STATELESS_CONSUMER, Boolean.TRUE);
}
target.configureTarget(tme, getContext());
// Set correlations
exchange.setProperty(correlation, tme.getExchangeId());
tme.setProperty(correlation, exchange.getExchangeId());
// Put exchange to store
store.store(exchange.getExchangeId(), exchange);
// Send in to listener and target
sendToListenerAndTarget(exchange, tme, inListener, "in", false);
// Mimic the exchange on the other side and send to needed listener
} else {
String id = (String) exchange.getProperty(correlation);
if (id == null) {
if (exchange.getRole() == MessageExchange.Role.CONSUMER
&& exchange.getStatus() != ExchangeStatus.ACTIVE) {
// This must be a listener status, so ignore
return;
}
throw new IllegalStateException(correlation + " property not found");
}
MessageExchange org = (MessageExchange) store.load(id);
if (org == null) {
throw new IllegalStateException("Could not load original exchange with id " + id);
}
// Reproduce DONE status to the other side
if (exchange.getStatus() == ExchangeStatus.DONE) {