messageHeader.setMessageData(new MessageData());
messageHeader.getMessageData().setMessageId(uuid + "@" + hostname);
messageHeader.getMessageData().setRefToMessageId(context.getRefToMessageId());
messageHeader.getMessageData().setTimestamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
ReliableMessaging rm = CPAUtils.getReliableMessaging(cpa,messageHeader);
if (rm != null)
{
GregorianCalendar timestamp = messageHeader.getMessageData().getTimestamp().toGregorianCalendar();
Duration d = rm.getRetryInterval().multiply(rm.getRetries().add(new BigInteger("1")).intValue());
d.addTo(timestamp);
timestamp.add(Calendar.SECOND,1);
messageHeader.getMessageData().setTimeToLive(DatatypeFactory.newInstance().newXMLGregorianCalendar(timestamp));
}