Package org.objectweb.joram.mom.notifications

Examples of org.objectweb.joram.mom.notifications.ClientMessages


    }
  }

  public void transmit(Message message, String messageId) {
    if (message != null) {
      Channel.sendTo(destination.getId(), new AcquisitionNot(new ClientMessages(-1, -1, message),
          isPersistent, messageId));
    }
  }
View Full Code Here


    }
  }

  public void transmit(List messages, String messagesId) {
    if (messages != null && messages.size() > 0) {
      Channel.sendTo(destination.getId(), new AcquisitionNot(new ClientMessages(-1, -1, messages),
          isPersistent, messagesId));
    }
  }
View Full Code Here

  }

  /** @see DistributionHandler#distribute(Message) */
  public void distribute(Message message) throws Exception {
    /* building a ClientMessages object for the notification */
    ClientMessages cm = new ClientMessages();
    cm.addMessage(message);

    /* building a notification that inherits messages properties (id and
     * persistent) */
    AcquisitionNot an = new AcquisitionNot(cm, message.persistent, message.id);

View Full Code Here

          Message message = getQueueMessage(msgId, true);
          if (message != null) {
            LBCycleLife cycle = (LBCycleLife) table.get(id);
            if (cycle == null) {
              cycle = new LBCycleLife(loadingFactor.getRateOfFlow());
              cycle.setClientMessages(new ClientMessages());
            }
            ClientMessages cm = cycle.getClientMessages();
            cm.addMessage(message.getFullMessage());
            cycle.putInVisitTable(msgId,visit);
            table.put(id,cycle);
            transmitted = true;
            break;
          }
View Full Code Here

    }

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "--- " + this + " ClusterQueue.lBCycleLife(" + not + "), visitTable="
          + clusters);
    ClientMessages cm = not.getClientMessages();
    if (cm != null)
      doClientMessages(from, cm);
  }
View Full Code Here

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "--- " + this + " ClusterQueue.lBMessageGive(" + from + "," + not + ")");

    clusters.put(from,new Float(not.getRateOfFlow()));

    ClientMessages cm = not.getClientMessages();
    if (cm != null) {
      doClientMessages(from, cm);
    }
  }
View Full Code Here

      int possibleGive = getPendingMessageCount() - getWaitingRequestCount();
      LBMessageGive msgGive =
        new LBMessageGive(loadingFactor.validityPeriod, loadingFactor.getRateOfFlow());
     
      // get client messages, hope or possible give.
      ClientMessages cm = null;
      if (possibleGive > hope) {
        cm = getClientMessages(hope, null, true);
      } else {
        cm = getClientMessages(possibleGive, null, true);
      }

      msgGive.setClientMessages(cm);
      msgGive.setRateOfFlow(loadingFactor.evalRateOfFlow(getPendingMessageCount(), getWaitingRequestCount()));

      // send notification contains ClientMessages.
      forward(from, msgGive);
     
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, "--- " + this
            + " ClusterQueue.lBMessageHope LBMessageHope : nbMsgSend = " + cm.getMessages().size());
    }
  }
View Full Code Here

   * @param selector  jms selector
   * @param remove    delete all messages returned if true
   * @return ClientMessages (contains nb Messages)
   */
  protected ClientMessages getClientMessages(int nb, String selector, boolean remove) {
    ClientMessages cm = super.getClientMessages(nb, selector, remove);
    if (cm != null) {
      // set information in cluster
      for (Iterator e = cm.getMessages().iterator(); e.hasNext();) {
        org.objectweb.joram.shared.messages.Message message =
          (org.objectweb.joram.shared.messages.Message) e.next();
        monitoringMsgSendToCluster(message.id);
      }
    }
View Full Code Here

    }
  }
 
  protected void requestGroupNot(AgentId from, RequestGroupNot not) {
    Enumeration en = not.getClientMessages();
    ClientMessages theCM = (ClientMessages) en.nextElement();
    Vector replies = new Vector();
    replies.addElement(new SendReplyNot(
        theCM.getClientContext(),
        theCM.getRequestId()));
    while (en.hasMoreElements()) {
      ClientMessages cm = (ClientMessages) en.nextElement();
      List msgs = cm.getMessages();
      for (int i = 0; i < msgs.size(); i++) {
        theCM.addMessage((Message) msgs.get(i));
      }
      if (! cm.getAsyncSend()) {
        replies.addElement(new SendReplyNot(
            cm.getClientContext(),
            cm.getRequestId()));
      }
    }
   
    doClientMessages(from, theCM);
View Full Code Here

                              String requestMsgId,
                              String replyMsgId) {
    Message message = MessageHelper.createMessage(replyMsgId, requestMsgId, getAgentId(), getType());
    try {
      message.setAdminMessage(reply);
      ClientMessages clientMessages = new ClientMessages(-1, -1, message);
      forward(replyTo, clientMessages);
    } catch (Exception exc) {
      if (logger.isLoggable(BasicLevel.ERROR))
        logger.log(BasicLevel.ERROR, "", exc);
      throw new Error(exc.getMessage());
View Full Code Here

TOP

Related Classes of org.objectweb.joram.mom.notifications.ClientMessages

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.