ConfigurationContext configCtx = rmMsgCtx.getMessageContext()
.getConfigurationContext();
if (configCtx == null)
throw new SandeshaException("Configuration Context is null");
SequencePropertyBean msgsBean = seqPropMgr.retrieve(sequenceId,
Sandesha2Constants.SequenceProperties.RECEIVED_MESSAGES);
long msgNo = sequence.getMessageNumber().getMessageNumber();
if (msgNo == 0)
throw new SandeshaException("Wrong message number");
String messagesStr = (String) msgsBean.getValue();
if (msgNoPresentInList(messagesStr, msgNo)
&& (Sandesha2Constants.QOS.InvocationType.DEFAULT_INVOCATION_TYPE == Sandesha2Constants.QOS.InvocationType.EXACTLY_ONCE)) {
//this is a duplicate message and the invocation type is
// EXACTLY_ONCE.
msgCtx.setPausedTrue(new QName(Sandesha2Constants.IN_HANDLER_NAME));
}
if (messagesStr != "" && messagesStr != null)
messagesStr = messagesStr + "," + Long.toString(msgNo);
else
messagesStr = Long.toString(msgNo);
msgsBean.setValue(messagesStr);
seqPropMgr.update(msgsBean);
sendAckIfNeeded(rmMsgCtx, messagesStr);
// Pause the messages bean if not the right message to invoke.
NextMsgBeanMgr mgr = storageManager.getNextMsgBeanMgr();
NextMsgBean bean = mgr.retrieve(sequenceId);
if (bean == null)
throw new SandeshaException("Error- The sequence does not exist");
InvokerBeanMgr storageMapMgr = storageManager.getStorageMapBeanMgr();
long nextMsgno = bean.getNextMsgNoToProcess();
if (msgCtx.isServerSide()) {
boolean inOrderInvocation = PropertyManager.getInstance().isInOrderInvocation();
if (inOrderInvocation) {
//pause the message
msgCtx.setPausedTrue(new QName(Sandesha2Constants.IN_HANDLER_NAME));
SequencePropertyBean incomingSequenceListBean = (SequencePropertyBean) seqPropMgr
.retrieve(
Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
if (incomingSequenceListBean == null) {
ArrayList incomingSequenceList = new ArrayList();
incomingSequenceListBean = new SequencePropertyBean();
incomingSequenceListBean
.setSequenceId(Sandesha2Constants.SequenceProperties.ALL_SEQUENCES);
incomingSequenceListBean
.setName(Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
incomingSequenceListBean.setValue(incomingSequenceList);
seqPropMgr.insert(incomingSequenceListBean);
}
ArrayList incomingSequenceList = (ArrayList) incomingSequenceListBean
.getValue();
//Adding current sequence to the incoming sequence List.
if (!incomingSequenceList.contains(sequenceId)) {
incomingSequenceList.add(sequenceId);
}
//saving the message.
try {
String key = SandeshaUtil.storeMessageContext(rmMsgCtx
.getMessageContext());
storageMapMgr.insert(new InvokerBean(key, msgNo,
sequenceId));
//This will avoid performing application processing more
// than
// once.
rmMsgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE,
"true");
} catch (Exception ex) {
throw new SandeshaException(ex.getMessage());
}
//Starting the invoker if stopped.
SandeshaUtil.startInvokerIfStopped(msgCtx.getConfigurationContext());
}
}
try {
MessageContext requestMessage = rmMsgCtx.getMessageContext()
.getOperationContext().getMessageContext(
WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String requestMessageId = requestMessage.getMessageID();
SequencePropertyBean checkResponseBean = seqPropMgr.retrieve(
requestMessageId,
Sandesha2Constants.SequenceProperties.CHECK_RESPONSE);
if (checkResponseBean != null) {
checkResponseBean.setValue(msgCtx);
seqPropMgr.update(checkResponseBean);
}
} catch (AxisFault e) {
throw new SandeshaException(e.getMessage());