Пример #1
0
  public void sendTopic(String destinationName, String text) {
    List<ProxyMessageConsumer> messageConsumers = messageConsumerMap.get(destinationName);

    if (messageConsumers == null) {
      return;
    }

    for (ProxyMessageConsumer messageConsumer : messageConsumers) {
      messageConsumer.sendMessage(text);
    }
  }
Пример #2
0
  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;
  }
Пример #3
0
  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);
  }