1 18 package org.apache.activemq.broker.region; 19 20 import org.apache.activemq.broker.Broker; 21 import org.apache.activemq.broker.ConnectionContext; 22 import org.apache.activemq.broker.ProducerBrokerExchange; 23 import org.apache.activemq.broker.region.policy.DeadLetterStrategy; 24 import org.apache.activemq.command.ActiveMQDestination; 25 import org.apache.activemq.command.Message; 26 import org.apache.activemq.command.MessageAck; 27 import org.apache.activemq.memory.UsageManager; 28 29 import java.io.IOException ; 30 import java.util.Iterator ; 31 import java.util.Set ; 32 33 37 public class DestinationFilter implements Destination { 38 39 private Destination next; 40 41 public DestinationFilter(Destination next) { 42 this.next = next; 43 } 44 45 public void acknowledge(ConnectionContext context, Subscription sub, MessageAck ack, MessageReference node) throws IOException { 46 next.acknowledge(context, sub, ack, node); 47 } 48 49 public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { 50 next.addSubscription(context, sub); 51 } 52 53 public Message[] browse() { 54 return next.browse(); 55 } 56 57 public void dispose(ConnectionContext context) throws IOException { 58 next.dispose(context); 59 } 60 61 public void gc() { 62 next.gc(); 63 } 64 65 public ActiveMQDestination getActiveMQDestination() { 66 return next.getActiveMQDestination(); 67 } 68 69 public DeadLetterStrategy getDeadLetterStrategy() { 70 return next.getDeadLetterStrategy(); 71 } 72 73 public DestinationStatistics getDestinationStatistics() { 74 return next.getDestinationStatistics(); 75 } 76 77 public String getName() { 78 return next.getName(); 79 } 80 81 public UsageManager getUsageManager() { 82 return next.getUsageManager(); 83 } 84 85 public boolean lock(MessageReference node, LockOwner lockOwner) { 86 return next.lock(node, lockOwner); 87 } 88 89 public void removeSubscription(ConnectionContext context, Subscription sub) throws Exception { 90 next.removeSubscription(context, sub); 91 } 92 93 public void send(ProducerBrokerExchange context, Message messageSend) throws Exception { 94 next.send(context, messageSend); 95 } 96 97 public void start() throws Exception { 98 next.start(); 99 } 100 101 public void stop() throws Exception { 102 next.stop(); 103 } 104 105 108 protected void send(ProducerBrokerExchange context, Message message, ActiveMQDestination destination) throws Exception { 109 Broker broker = context.getConnectionContext().getBroker(); 110 Set destinations = broker.getDestinations(destination); 111 112 for (Iterator iter = destinations.iterator(); iter.hasNext();) { 113 Destination dest = (Destination) iter.next(); 114 dest.send(context, message); 115 } 116 } 117 } 118 | Popular Tags |