if(transaction != null && transaction.isActive()) transaction.commit();
MessageContext outMessage = terminateSequenceResponse.getMessageContext();
EndpointReference toEPR = outMessage.getTo();
AxisEngine engine = new AxisEngine(terminateSeqMsg.getConfigurationContext());
outMessage.setServerSide(true);
try {
engine.send(outMessage);
} catch (AxisFault e) {
if (log.isDebugEnabled())
log.debug("Unable to send terminate sequence response", e);
throw new SandeshaException(
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendTerminateResponse), e);
}
if (toEPR.hasAnonymousAddress()) {
terminateSeqMsg.getOperationContext().setProperty(
org.apache.axis2.Constants.RESPONSE_WRITTEN, "true");
} else {
terminateSeqMsg.getOperationContext().setProperty(
org.apache.axis2.Constants.RESPONSE_WRITTEN, "false");
}
} else {
//if RM 1.0 Anonymous scenario we will be trying to attache the TerminateSequence of the response side
//as the response message.
String outgoingSideInternalSeqId = SandeshaUtil.getOutgoingSideInternalSequenceID(sequenceId);
SenderBean senderFindBean = new SenderBean ();
senderFindBean.setInternalSequenceID(outgoingSideInternalSeqId);
senderFindBean.setMessageType(Sandesha2Constants.MessageTypes.TERMINATE_SEQ);
senderFindBean.setSend(true);
senderFindBean.setReSend(false);
SenderBean outgoingSideTerminateBean = storageManager.getSenderBeanMgr().findUnique(senderFindBean);
if (outgoingSideTerminateBean!=null) {
EndpointReference toEPR = new EndpointReference (outgoingSideTerminateBean.getToAddress());
if (toEPR.hasAnonymousAddress()) {
String messageKey = outgoingSideTerminateBean
.getMessageContextRefKey();
MessageContext message = storageManager
.retrieveMessageContext(messageKey, context);
RMMsgContext rmMessage = MsgInitializer.initializeMessage(message);
// attaching the this outgoing terminate message as the
// response to the incoming terminate message.
message.setTransportOut(terminateSeqMsg.getTransportOut());
message.setProperty(MessageContext.TRANSPORT_OUT,terminateSeqMsg.getProperty(MessageContext.TRANSPORT_OUT));
message.setProperty(Constants.OUT_TRANSPORT_INFO, terminateSeqMsg.getProperty(Constants.OUT_TRANSPORT_INFO));
terminateSeqMsg.getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN, "true");
AxisEngine engine = new AxisEngine(context);
try {
engine.send(message);
} catch (AxisFault e) {
if (log.isDebugEnabled())
log.debug("Unable to send terminate sequence response", e);
throw new SandeshaException(