Esempio n. 1
0
  /**
   * This is called remotely from other cluster members when a new remote subscription is
   * identified.
   *
   * <p>We add or remove a remote subscription...
   */
  public void subscribeFromPeer(
      String destinationId,
      Boolean subscribe,
      String selector,
      String subtopic,
      Object remoteAddress) {
    Destination destination = getDestination(destinationId);

    RemoteSubscriptionManager subMgr =
        ((MessageDestination) destination).getRemoteSubscriptionManager();

    if (destination instanceof MessageDestination) {
      if (debug)
        Log.getLogger(MessageService.LOG_CATEGORY)
            .debug(
                "Received subscription from peer: "
                    + remoteAddress
                    + " subscribe? "
                    + subscribe
                    + " selector: "
                    + selector
                    + " subtopic: "
                    + subtopic);
      if (subscribe) subMgr.addSubscriber(remoteAddress, selector, subtopic, null);
      else subMgr.removeSubscriber(remoteAddress, selector, subtopic, null);
    } else if (Log.isError())
      Log.getLogger(LOG_CATEGORY)
          .error(
              "subscribeFromPeer called with destination: "
                  + destinationId
                  + " that is not a MessageDestination");
  }