1 18 package org.apache.activemq.broker.policy; 19 20 import org.apache.activemq.advisory.AdvisorySupport; 21 import org.apache.activemq.broker.BrokerService; 22 import org.apache.activemq.broker.region.policy.PolicyEntry; 23 import org.apache.activemq.broker.region.policy.PolicyMap; 24 import org.apache.activemq.command.ActiveMQDestination; 25 26 import javax.jms.Destination ; 27 import javax.jms.Message ; 28 29 33 public class NoConsumerDeadLetterTest extends DeadLetterTestSupport { 34 35 public void testDurableQueueMessage() throws Exception { 37 } 38 39 public void testDurableTopicMessage() throws Exception { 40 } 41 42 public void testTransientQueueMessage() throws Exception { 43 } 44 45 protected void doTest() throws Exception { 46 makeDlqConsumer(); 47 sendMessages(); 48 49 for (int i =0; i < messageCount; i++){ 50 Message msg = dlqConsumer.receive(1000); 51 assertNotNull("Should be a message for loop: " + i, msg); 52 } 53 } 54 55 protected BrokerService createBroker() throws Exception { 56 BrokerService broker = super.createBroker(); 57 58 PolicyEntry policy = new PolicyEntry(); 59 policy.setSendAdvisoryIfNoConsumers(true); 60 61 PolicyMap pMap = new PolicyMap(); 62 pMap.setDefaultEntry(policy); 63 64 broker.setDestinationPolicy(pMap); 65 66 return broker; 67 } 68 69 protected Destination createDlqDestination() { 70 return AdvisorySupport.getNoTopicConsumersAdvisoryTopic((ActiveMQDestination) getDestination()); 71 } 72 73 } 74 | Popular Tags |