if (logger.isTraceEnabled()) {
logger.trace("Received: " + jmsMessage);
}
try {
JmsContext context = marshaler.createContext(jmsMessage);
MessageExchange exchange = marshaler.createExchange(context, getContext());
configureExchangeTarget(exchange);
if (synchronous) {
try {
sendSync(exchange);
} catch (Exception e) {
handleException(exchange, e, session, context);
}
if (exchange.getStatus() != ExchangeStatus.DONE) {
processExchange(exchange, session, context);
}
} else {
if (stateless) {
exchange.setProperty(PROP_JMS_CONTEXT, context);
} else {
store.store(exchange.getExchangeId(), context);
}
boolean success = false;
try {
send(exchange);
success = true;
} catch (Exception e) {
handleException(exchange, e, session, context);
} finally {
if (!success && !stateless) {
store.load(exchange.getExchangeId());
}
}
}
} catch (JMSException e) {
throw e;