} else {
Transaction asyncAckTransaction = storageManager.getTransaction();
SenderBeanMgr retransmitterBeanMgr = storageManager
.getRetransmitterBeanMgr();
String key = SandeshaUtil.getUUID();
SenderBean ackBean = new SenderBean();
ackBean.setMessageContextRefKey(key);
ackBean.setMessageID(ackMsgCtx.getMessageID());
ackBean.setReSend(false);
ackBean.setSequenceID(sequenceID);
//this will be set to true in the sender.
ackBean.setSend(true);
ackMsgCtx.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,
Sandesha2Constants.VALUE_FALSE);
ackBean.setMessageType(Sandesha2Constants.MessageTypes.ACK);
long ackInterval = SandeshaUtil.getPropertyBean(referenceMsg.getAxisOperation()).getAcknowledgementInaterval();
//Ack will be sent as stand alone, only after the retransmitter
// interval.
long timeToSend = System.currentTimeMillis() + ackInterval;
//removing old acks.
SenderBean findBean = new SenderBean();
findBean.setMessageType(Sandesha2Constants.MessageTypes.ACK);
//this will be set to true in the sandesha2TransportSender.
findBean.setSend(true);
findBean.setReSend(false);
Collection coll = retransmitterBeanMgr.find(findBean);
Iterator it = coll.iterator();
if (it.hasNext()) {
SenderBean oldAckBean = (SenderBean) it.next();
timeToSend = oldAckBean.getTimeToSend(); //If there is an old ack. This ack will be sent in the old timeToSend.
retransmitterBeanMgr.delete(oldAckBean.getMessageID());
}
ackBean.setTimeToSend(timeToSend);
storageManager.storeMessageContext(key,ackMsgCtx);
//inserting the new ack.
retransmitterBeanMgr.insert(ackBean);
asyncAckTransaction.commit();
//passing the message through sandesha2sender
ackMsgCtx.setProperty(Sandesha2Constants.ORIGINAL_TRANSPORT_OUT_DESC,ackMsgCtx.getTransportOut());
ackMsgCtx.setProperty(Sandesha2Constants.SET_SEND_TO_TRUE,Sandesha2Constants.VALUE_TRUE);