1 22 package org.jboss.resource.adapter.jms.inflow.dlq; 23 24 import javax.jms.Message ; 25 import javax.naming.Context ; 26 27 import org.jboss.resource.adapter.jms.inflow.JmsActivation; 28 29 35 public class JBossMQDLQHandler extends AbstractDLQHandler 36 { 37 38 protected static final String JMS_JBOSS_REDELIVERY_COUNT = "JMS_JBOSS_REDELIVERY_COUNT"; 39 40 41 protected static final String JMS_JBOSS_REDELIVERY_LIMIT = "JMS_JBOSS_REDELIVERY_LIMIT"; 42 43 44 protected int maxResent; 45 46 public void setup(JmsActivation activation, Context ctx) throws Exception 47 { 48 super.setup(activation, ctx); 49 maxResent = activation.getActivationSpec().getDLQMaxResent(); 50 } 51 52 protected boolean handleDelivery(Message msg) 53 { 54 int max = maxResent; 55 try 56 { 57 if (msg.propertyExists(JMS_JBOSS_REDELIVERY_LIMIT)) 58 max = msg.getIntProperty(JMS_JBOSS_REDELIVERY_LIMIT); 59 60 if (msg.propertyExists(JMS_JBOSS_REDELIVERY_COUNT)) 61 { 62 int count = msg.getIntProperty(JMS_JBOSS_REDELIVERY_COUNT); 63 64 if (count > max) 65 { 66 warnDLQ(msg, count, max); 67 return true; 68 } 69 } 70 } 71 catch (Throwable t) 72 { 73 log.warn("Unexpected error retrieving message properties " + msg, t); 74 } 75 return false; 76 } 77 } | Popular Tags |