// Deciding whether this is the last message. We assume it is if it relates to
// a message which arrived with the LastMessage flag on it.
RMDBean rmdBean = SandeshaUtil.getRMDBeanFromSequenceId(storageManager, inboundSequence);
// Get the last in message
String lastRequestId = rmdBean.getLastInMessageId();
RelatesTo relatesTo = msgContext.getRelatesTo();
if(relatesTo != null && lastRequestId != null &&
lastRequestId.equals(relatesTo.getValue())) {
lastMessage = true;
}
//or a constant property may call it as the last msg
Boolean inboundLast = (Boolean) msgContext.getProperty(Sandesha2Constants.MessageContextProperties.INBOUND_LAST_MESSAGE);
if (inboundLast!=null && inboundLast.booleanValue())
lastMessage = true;
}
if (lastMessage)
rmsBean.setLastOutMessage(messageNumber);
// set this as the response highest message.
rmsBean.setHighestOutMessageNumber(messageNumber);
// saving the used message number, and the expected reply count
boolean startPolling = false;
if (!dummyMessage) {
rmsBean.setNextMessageNumber(messageNumber);
// Identify the MEP associated with the message.
AxisOperation op = msgContext.getAxisOperation();
int mep = WSDLConstants.MEP_CONSTANT_INVALID;
if(op != null) {
mep = op.getAxisSpecifMEPConstant();
}
if(mep == WSDLConstants.MEP_CONSTANT_OUT_IN) {
// We only match up requests and replies when we are doing sync interactions
EndpointReference replyTo = msgContext.getReplyTo();
if(replyTo == null || replyTo.hasAnonymousAddress()) {
long expectedReplies = rmsBean.getExpectedReplies();
rmsBean.setExpectedReplies(expectedReplies + 1);
}
// If we support the RM anonymous URI then rewrite the ws-a anon to use the RM equivalent.
//(do should be done only for WSRM 1.1)
if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(rmMsgCtx.getRMSpecVersion())) {
String oldAddress = (replyTo == null) ? null : replyTo.getAddress();
EndpointReference newReplyTo = SandeshaUtil.rewriteEPR(rmsBean, msgContext
.getReplyTo(), configContext);
String newAddress = (newReplyTo == null) ? null : newReplyTo.getAddress();
if (newAddress != null && !newAddress.equals(oldAddress)) {
// We have rewritten the replyTo. If this is the first message that we have needed to
// rewrite then we should set the sequence up for polling, and once we have saved the
// changes to the sequence then we can start the polling thread.
msgContext.setReplyTo(newReplyTo);
if (!rmsBean.isPollingMode()) {
rmsBean.setPollingMode(true);
startPolling = true;
}
}
}
}
}
RelatesTo relatesTo = msgContext.getRelatesTo();
if(relatesTo != null) {
rmsBean.setHighestOutRelatesTo(relatesTo.getValue());
}
// setting async ack endpoint for the server side. (if present)
if (serverSide) {
if (rmsBean.getToEPR() != null) {