}
}
protected void doAsyncReply(MyRoleMessageExchangeImpl m) {
MessageExchangeDAO mex = m.getDAO();
PartnerRoleMessageExchange pmex = null;
if (mex.getPipedMessageExchangeId() != null) {
pmex = (PartnerRoleMessageExchange) _bpelProcess
.getEngine().getMessageExchange(mex.getPipedMessageExchangeId());
}
if (pmex != null) {
if (BpelProcess.__log.isDebugEnabled()) {
__log.debug("Replying to a p2p mex, myrole " + m + " - partnerole " + pmex);
}
if (pmex.getStatus() == Status.ASYNC || pmex.getStatus() == Status.REQUEST) {
try {
switch (m.getStatus()) {
case FAILURE:
// We can't seem to get the failure out of the myrole mex?
pmex.replyWithFailure(MessageExchange.FailureType.OTHER, "operation failed", null);
break;
case FAULT:
Fault fault = pmex.getOperation().getFault(m.getFault().getLocalPart());
if (fault == null) {
__log.error("process " + _bpelProcess + " instance " + _iid + " thrown unmapped fault in p2p communication " + m.getFault() + " " + m.getFaultExplanation() + " - converted to failure");
pmex.replyWithFailure(MessageExchange.FailureType.OTHER, "process thrown unmapped fault in p2p communication " + m.getFault() + " " + m.getFaultExplanation() + " - converted to failure", m.getFaultResponse().getMessage());
} else {
Message faultRes = pmex.createMessage(pmex.getOperation().getFault(m.getFault().getLocalPart())
.getMessage().getQName());
faultRes.setMessage(m.getResponse().getMessage());
pmex.replyWithFault(m.getFault(), faultRes);
}
break;
case RESPONSE:
Message response = pmex.createMessage(pmex.getOperation().getOutput().getMessage().getQName());
response.setMessage(m.getResponse().getMessage());
pmex.reply(response);
break;
default:
__log.warn("Unexpected state: " + m.getStatus());
break;
}