Package com.caucho.bam.stream

Examples of com.caucho.bam.stream.MessageStream


    if (log.isLoggable(Level.FINEST)) {
      log.finest(this + ": message " + payload
                 + "\n  {to: " + to + ", from:" + from + "}");
    }
   
    MessageStream toStream = getMailbox(to);
   
    if (toStream != null) {
      toStream.message(to, from, payload);
      return;
    }

    String msg;
    msg = (this + ": message to unknown actor"
           + "\n  to: " + to
           + "\n  from: " + from
           + "\n  payload: " + payload);
   
    if (log.isLoggable(Level.FINER)) {
      log.finer(msg);
    }

    BamError error = new BamError(BamError.TYPE_CANCEL,
                                      BamError.ITEM_NOT_FOUND,
                                      msg);

    MessageStream fromStream = getMailbox(from);

    if (fromStream != null)
      fromStream.messageError(from, to, payload, error);
  }
View Full Code Here


      log.finest(this + ": messageError " + error
                 + "\n  " + payload
                 + "\n  {to: " + to + ", from:" + from + "}");
    }
   
    MessageStream toStream = getMailbox(to);
   
    if (toStream != null) {
      toStream.messageError(to, from, payload, error);
      return;
    }

    String msg;
    msg = (this + ": messageError to unknown actor to:" + to
View Full Code Here

    if (log.isLoggable(Level.FINEST)) {
      log.finest(this + ": query(" + id + ") " + payload
                 + "\n  {to: " + to + ", from:" + from + "}");
    }
   
    MessageStream toStream = getMailbox(to);
   
    if (toStream != null) {
      toStream.query(id, to, from, payload);
      return;
    }

    String msg;
    msg = (this + ": query(" + id + ") to unknown actor to:" + to
           + "\n  from:" + from
           + "\n  payload:" + payload);
   
    if (log.isLoggable(Level.FINER)) {
      log.finer(msg);
    }

    BamError error = new BamError(BamError.TYPE_CANCEL,
                                      BamError.ITEM_NOT_FOUND,
                                      msg);

    MessageStream fromStream = getMailbox(from);

    if (fromStream != null)
      fromStream.queryError(id, from, to, payload, error);
  }
View Full Code Here

    if (log.isLoggable(Level.FINEST)) {
      log.finest(this + ": queryResult(" + id + ") " + payload
                 + "\n  {to: " + to + ", from:" + from + "}");
    }
   
    MessageStream toStream = getMailbox(to);
   
    if (toStream != null) {
      toStream.queryResult(id, to, from, payload);
      return;
    }

    String msg;
    msg = (this + ": queryResult(qid=" + id + ") to unknown actor"
View Full Code Here

      log.finest(this + ": queryError(" + id + ") " + error
                 + "\n  " + payload
                 + "\n  {to: " + to + ", from:" + from + "}");
    }
   
    MessageStream toStream = getMailbox(to);
   
    if (toStream != null) {
      toStream.queryError(id, to, from, payload, error);
      return;
    }

    String msg;
    msg = (this + ": queryError(" + id + ") to unknown actor to:" + to
View Full Code Here

    Mailbox mailbox = new MultiworkerMailbox(next.getAddress(),
                                             _actor,
                                             broker,
                                             1);

    MessageStream stream = broker.createClient(mailbox, uid, resource);
    _clientAddress = stream.getAddress();
  }
View Full Code Here

    Mailbox mailbox = new MultiworkerMailbox(null,
                                             _actor,
                                             broker,
                                             1);

    MessageStream stream = broker.createClient(mailbox, uid, resource);
    _clientAddress = stream.getAddress();
  }
View Full Code Here

   * @param payload the message payload
   */
  @Override
  public void message(String to, Serializable payload)
  {
    MessageStream broker = getBroker();

    if (broker == null)
      throw new IllegalStateException(this + " can't send a message because the link is closed.");

    broker.message(to, getAddress(), payload);
  }
View Full Code Here

  @Override
  public Serializable query(String to,
                            Serializable payload,
                            long timeout)
  {
    MessageStream linkStream = getBroker();

    if (linkStream == null)
      throw new IllegalStateException(this + " can't send a query because the link is closed.");

    long id = _queryManager.nextQueryId();
   
    QueryFuture future
      = _queryManager.addQueryFuture(id, to, getAddress(), payload, timeout);

    linkStream.query(id, to, getAddress(), payload);
   
    return future.get();
  }
View Full Code Here

  public void query(String to,
                    Serializable payload,
                    QueryCallback callback,
                    long timeout)
  {
    MessageStream linkStream = getBroker();

    if (linkStream == null)
      throw new IllegalStateException(this + " can't send a query because the link is closed.");

    long id = _queryManager.nextQueryId();
   
    _queryManager.addQueryCallback(id, callback, timeout);
   
    linkStream.query(id, to, getAddress(), payload);
  }
View Full Code Here

TOP

Related Classes of com.caucho.bam.stream.MessageStream

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.