// Ensure the outbound message us secured using the correct token
RMMsgCreator.secureOutboundMessage(getRMSBean(), msgContext);
String key = SandeshaUtil.getUUID();
SenderBean senderBean = new SenderBean();
senderBean.setMessageType(msgType);
senderBean.setMessageContextRefKey(key);
senderBean.setTimeToSend(System.currentTimeMillis() + delay);
senderBean.setMessageID(msgContext.getMessageID());
// Set the internal sequence id and outgoing sequence id for the terminate message
senderBean.setInternalSequenceID(internalSequenceID);
if (sequenceExists)
{
senderBean.setSend(true);
senderBean.setSequenceID(outSequenceID);
}
else
senderBean.setSend(false);
EndpointReference to = msgContext.getTo();
if (to!=null)
senderBean.setToAddress(to.getAddress());
// If this message is targetted at an anonymous address then we must not have a transport
// ready for it, as the current message is not a reply.
if(to == null || to.hasAnonymousAddress())
senderBean.setTransportAvailable(false);
msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_FALSE);
senderBean.setReSend(false);
SenderBeanMgr retramsmitterMgr = storageManager.getSenderBeanMgr();
SandeshaUtil.executeAndStore(rmMsgCtx, key);