// We must reference the message *before* we send it the destination to be handled. This is
// so we can guarantee that the message doesn't disappear from the store before the
// handling is complete. Each channel then takes copies of the reference if they decide to
// maintain it internally
MessageReference ref = msg.createReference();
if (checkForDuplicates)
{
if (serverPeer.getPersistenceManagerInstance().idExists(msg.getJMSMessageID()))
{
log.trace("ID exists in ID cache, probably duplicate sent on failover");
return false;
}
}
long schedDeliveryTime = msg.getScheduledDeliveryTime();
if (schedDeliveryTime > 0)
{
ref.setScheduledDeliveryTime(schedDeliveryTime);
}
if (dest.isDirect())
{
if (trace) { log.trace(this + " routing " + msg + " to direct destination"); }
//Route directly to queue - temp kludge for clustering
Binding binding = postOffice.getBindingForQueueName(dest.getName());
if (binding == null)
{
throw new IllegalArgumentException("Cannot find binding for queue " + dest.getName());
}
Queue queue = binding.queue;
Long scid = (Long)ref.getMessage().removeHeader(Message.SOURCE_CHANNEL_ID);
Delivery del = queue.handleMove(ref, scid.longValue());
if (del == null)
{