1 18 package org.apache.activemq.broker.region.virtual; 19 20 import org.apache.activemq.broker.ProducerBrokerExchange; 21 import org.apache.activemq.broker.region.Destination; 22 import org.apache.activemq.broker.region.DestinationFilter; 23 import org.apache.activemq.command.ActiveMQDestination; 24 import org.apache.activemq.command.ActiveMQQueue; 25 import org.apache.activemq.command.Message; 26 27 33 public class VirtualTopicInterceptor extends DestinationFilter { 34 35 private String prefix; 36 private String postfix; 37 38 public VirtualTopicInterceptor(Destination next, String prefix, String postfix) { 39 super(next); 40 this.prefix = prefix; 41 this.postfix = postfix; 42 } 43 44 public void send(ProducerBrokerExchange context, Message message) throws Exception { 45 ActiveMQDestination queueConsumers = getQueueConsumersWildcard(message.getDestination()); 46 send(context, message, queueConsumers); 47 } 48 49 protected ActiveMQDestination getQueueConsumersWildcard(ActiveMQDestination original) { 50 return new ActiveMQQueue(prefix + original.getPhysicalName() + postfix); 51 } 52 } 53 | Popular Tags |