public void sendTopic(String destinationName, String text) { List<ProxyMessageConsumer> messageConsumers = messageConsumerMap.get(destinationName); if (messageConsumers == null) { return; } for (ProxyMessageConsumer messageConsumer : messageConsumers) { messageConsumer.sendMessage(text); } }
public MessageConsumer createConsumer(Destination destination, ProxySession session) { String destinationName = destination.toString(); List<ProxyMessageConsumer> messageConsumers = messageConsumerMap.get(destinationName); if (messageConsumers == null) { messageConsumers = new ArrayList<ProxyMessageConsumer>(); messageConsumerMap.put(destinationName, messageConsumers); } ProxyMessageConsumer messageConsumer = new ProxyMessageConsumer(session); messageConsumer.setDestination(destination); messageConsumers.add(messageConsumer); return messageConsumer; }
public void removeMessageConsumer(ProxyMessageConsumer messageConsumer) { Destination destination = messageConsumer.getDestination(); String destinationName = destination.toString(); List<ProxyMessageConsumer> messageConsumers = messageConsumerMap.get(destinationName); if (messageConsumers == null) { return; } messageConsumers.remove(messageConsumer); }