//subscriptions of a topic for example
//We set headers that hold the original message destination, expiry time and original message id
if (trace) { log.trace("Making copy of message for DLQ or expiry " + del); }
JBossMessage msg = ((JBossMessage)del.getReference().getMessage());
JBossMessage copy = msg.doCopy();
long newMessageId = sp.getMessageIDManager().getID();
copy.setMessageId(newMessageId);
//reset expiry
copy.setExpiration(0);
String origMessageId = msg.getJMSMessageID();
String origDest = msg.getJMSDestination().toString();
copy.setStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_MESSAGE_ID, origMessageId);
copy.setStringProperty(JBossMessage.JBOSS_MESSAGING_ORIG_DESTINATION, origDest);
if (expiry)
{
long actualExpiryTime = System.currentTimeMillis();
copy.setLongProperty(JBossMessage.JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME, actualExpiryTime);
}
return copy;
}