* without error, otherwise null.
*/
private Message attemptDelivery(Message message, EPR epr) throws FaultMessageException, MalformedEPRException, MessageDeliverException {
TwoWayCourier courier = null;
final EPR targetEPR ;
if ((extensions != null) && (extensions.size() > 0))
{
targetEPR = EPRHelper.copyEPR(epr, extensions) ;
}
else
{
targetEPR = epr ;
}
// Get a courier for the EPR...
try {
courier = getCourier(targetEPR);
} catch (CourierException e) {
if (logger.isDebugEnabled()) {
logger.debug("Courier lookup failed for EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"].", e);
}
} catch (MalformedEPRException e) {
// probably an ESB-unaware EPR in the registry!!
logger.info("Badly formed EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"]." + e.getMessage());
throw e;
} catch (Throwable t) {
logger.warn("Unexpected exception during Courier lookup for EPR [" + targetEPR + "] for Service [" + service + "] and Message ["+message.getHeader()+"].", t);
}
// Try delivering the message using the courier we just looked up....
if (courier != null) {
// make sure the message header does not change when we exit
final Call call = message.getHeader().getCall() ;
final EPR currentToEpr = call.getTo() ;
final EPR currentReplyToEpr = call.getReplyTo() ;
try {
call.setTo(targetEPR);
final EPR replyToEPR ;
if (synchronous) {
/*
* Currently all couriers that have transactional semantics work in a manner similar
* to JMS, i.e., messages are not delivered on to a queue (or to an endpoint) until
* the enclosing transaction has committed. In a synchronous invocation this will