public void sendToDeadLetterQueue(ConnectionContext context,
MessageReference node){
try{
boolean sent=false;
if(node!=null){
Message message=node.getMessage();
if(message!=null&&node.getRegionDestination()!=null){
DeadLetterStrategy deadLetterStrategy=node
.getRegionDestination().getDeadLetterStrategy();
if(deadLetterStrategy!=null){
if(deadLetterStrategy.isSendToDeadLetterQueue(message)){
long expiration=message.getExpiration();
message.setExpiration(0);
message.setProperty("originalExpiration",new Long(
expiration));
if(!message.isPersistent()){
message.setPersistent(true);
message.setProperty("originalDeliveryMode",
"NON_PERSISTENT");
}
// The original destination and transaction id do
// not get filled when the message is first
// sent,
// it is only populated if the message is routed to
// another destination like the DLQ
ActiveMQDestination deadLetterDestination=deadLetterStrategy
.getDeadLetterQueueFor(message
.getDestination());
if (context.getBroker()==null) {
context.setBroker(getRoot());
}
BrokerSupport.resend(context,message,