log.error(message);
throw new SandeshaException(message);
}
SenderBeanMgr retransmitterMgr = storageManager.getSenderBeanMgr();
RMSBeanMgr rmsBeanMgr = storageManager.getRMSBeanMgr();
RMSBean rmsBean = rmsBeanMgr.retrieve(createSeqMsgId);
if (rmsBean == null) {
String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.createSeqEntryNotFound);
log.debug(message);
throw new SandeshaException(message);
}
//Need to see if the seqID is a dupe of one that already exists
//If it is we can't accept the CSR, so will do nothing so that a new CreateSeq msg is sent
RMSBean finderBean = new RMSBean ();
finderBean.setSequenceID(newOutSequenceId);
RMSBean rmsBeanWithDuplicateSeqID = storageManager.getRMSBeanMgr().findUnique(finderBean);
if(rmsBeanWithDuplicateSeqID != null){
if (log.isDebugEnabled())
log.debug("Duplicate SeqID: " + newOutSequenceId + " so we can't accept the CSR, will terminate this seq and reallocate to a new seq");
return false;
}
// Check that the create sequence response message proves possession of the correct token
MessageContext msgCtx = createSeqResponseRMMsgCtx.getMessageContext();
SandeshaUtil.assertProofOfPossession(rmsBean, msgCtx, msgCtx.getEnvelope().getBody());
String internalSequenceId = rmsBean.getInternalSequenceID();
if (internalSequenceId == null || "".equals(internalSequenceId)) {
String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.tempSeqIdNotSet);
log.debug(message);
throw new SandeshaException(message);
}
createSeqResponseRMMsgCtx.setProperty(Sandesha2Constants.MessageContextProperties.INTERNAL_SEQUENCE_ID,internalSequenceId);
// Check to see if we have already received a sequence id. If we have then this response is redundant,
// and we can forget about it.
// TODO: Should we terminate or close the extra sequence? We can only do that if the new sequence
// id is different from the one we got back the first time. For now it should be enough to just
// ignore it, and let it time out.
if(rmsBean.getSequenceID() != null) {
if(log.isDebugEnabled())
log.debug("Exit: CreateSeqResponseMsgProcessor::processInMessage, sequence id is already set. " +
"Existing id:" + rmsBean.getSequenceID() + ", new id:" + newOutSequenceId);
return false;
}
// Store the new sequence id
rmsBean.setSequenceID(newOutSequenceId);
// We should poll for any reply-to that uses the anonymous URI, when MakeConnection
// is enabled.
if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(createSeqResponseRMMsgCtx.getRMSpecVersion())) {
SandeshaPolicyBean policy = SandeshaUtil.getPropertyBean(configCtx.getAxisConfiguration());
if(policy.isEnableMakeConnection()) {
EndpointReference reference = rmsBean.getAcksToEndpointReference();
if(reference == null || reference.hasAnonymousAddress()) {
rmsBean.setPollingMode(true);
}
}
}
rmsBean.setLastActivatedTime(System.currentTimeMillis());
if(!rmsBeanMgr.update(rmsBean)){
//Im not setting the createSeqBean sender bean to resend true as the reallocation of msgs will do this
try{
TerminateManager.terminateSendingSide(rmsBean, storageManager, true, transaction);
} catch(Exception e){
if (log.isDebugEnabled())