// first make sure we have the room to put it on the
// queue ... if we dont, an exception will be thrown
// from queue Message
boolean route = false;
PacketReference ref = null;
try {
newp.generateSequenceNumber(false);
newp.generateTimestamp(false);
newp.fill(p);
newp.setProperties(props);
if (truncateBody) {
newp.setMessageBody(new byte[0]);
}
ref = PacketReference.createReference(
newp, deadMessageQueue.getDestinationUID(), null);
ref.overrideExpireTime(0);
ref.clearExpirationInfo();
ref.setTimestamp(System.currentTimeMillis());
synchronized (deadMessageQueue) {
ref.setSequence(deadMessageQueue.seqCnt++);
}
routeMoveAndForwardMessage(pr, ref, deadMessageQueue);
} catch (Exception ex) {
// depending on the type, we either ignore or throw out
if (reason == RemoveReason.UNDELIVERABLE ||
reason == RemoveReason.ERROR) {
if (ex instanceof BrokerException) {
throw (BrokerException) ex;
}
throw new BrokerException(
br.getKString( BrokerResources.X_DMQ_MOVE_INVALID), ex);
}
if (DEBUG || useVerbose) {
logger.logStack(Logger.WARNING, BrokerResources.W_DMQ_ADD_FAILURE,
pr.getSysMessageID().toString(), ex);
}
}
if ( (DEBUG || useVerbose) && useDMQforMsg ) {
String args[] = { pr.getSysMessageID().toString(),
pr.getDestinationUID().toString(),
lookupReasonString(reason,
receivedTime, expiredTime, senderTime) };
logger.log(Logger.INFO, BrokerResources.I_DMQ_MOVING_TO_DMQ,
args);
}
ref.unload();
}