Ejemplo n.º 1
0
  // TODO new publish
  public void onPublish(String sessionId, WampPublishMessage wampPublishMessage)
      throws SerializationException {
    EventAction e = eventMapping.getAction(wampPublishMessage.getTopicId());
    if (e != null) {
      OutputWampEventMessage msg = new OutputWampEventMessage();
      msg.setTopicId(wampPublishMessage.getTopicId());
      msg.setEvent(wampPublishMessage.getEvent());

      // e.publishTo think about it
      List<String> publishList =
          e.publishTo(getPublishList(e, sessionId, wampPublishMessage), wampPublishMessage, msg);
      if (publishList != null) for (String s : publishList) sendEvent(s, msg);

    } else if (log.isDebugEnabled())
      log.debug(
          "unable to publish : action name doesn't not exist " + wampPublishMessage.getTopicId());
  }
Ejemplo n.º 2
0
  private List<String> getPublishList(
      EventAction e, String sessionId, WampPublishMessage wampPublishMessage) {
    if (wampPublishMessage.getEligible() != null) return wampPublishMessage.getEligible();

    List<String> res;
    if (wampPublishMessage.getExclude() != null) {
      res = new ArrayList<String>(e.getSubscriber());
      for (String s : wampPublishMessage.getExclude()) res.remove(s);
    } else {
      if (wampPublishMessage.isExcludeMe()) {
        res = new ArrayList<String>(e.getSubscriber());
        res.remove(sessionId);
      } else res = new ArrayList<String>(e.getSubscriber());
    }

    return res;
  }