Package org.jboss.errai.bus.client.api

Examples of org.jboss.errai.bus.client.api.Message


                sb.append(buffer.get());
            }
            buffer.rewind();
        }

        Message m = createCommandMessage(session, sb.toString());
        if (m != null) {
            service.store(m);
        }

        pollQueue(service.getBus().getQueue(session), httpServletRequest, httpServletResponse);
View Full Code Here


                }
                buffer.rewind();
            }


            Message msg = createCommandMessage(sessionProvider.getSession(request.getSession(),
                    request.getHeader(ClientMessageBus.REMOTE_QUEUE_ID_HEADER)), sb.toString());
            if (msg != null) {
                service.store(msg);
                return 1;
            } else {
View Full Code Here

                sb.append(buffer.get());
            }
            buffer.rewind();
        }

        Message msg = createCommandMessage(sessionProvider.getSession(request.getSession(),
                request.getHeader(REMOTE_QUEUE_ID_HEADER)), sb.toString());
        if (msg != null) {
            service.store(msg);
            return 1;
        } else {
View Full Code Here

    activityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        detailsModel.clear();

        Message m = UiHelper.uglyReEncode((String) tableModel.getValueAt(activityTable.getSelectedRow(), 1));
        if (m == null) return;

        for (Map.Entry<String, Object> entry : m.getParts().entrySet()) {
          detailsModel.addPart(entry.getKey(), entry.getValue());
        }

        detailsModel.fireTableRowsUpdated(0, m.getParts().size() - 1);
        detailsModel.fireTableDataChanged();
      }
    });

    detailsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
View Full Code Here

  }

  public void attach(ActivityProcessor proc) {
    handle = proc.registerEvent(EventType.MESSAGE, new MessageMonitor() {
      public void monitorEvent(MessageEvent event) {
        Message m = (Message) event.getContents();
        // if the message is sent to the currently monitored bus (or is global) and the subject matches, then notify
        if ((event.getToBus().equals(busId) || !m.isFlagSet(RoutingFlag.NonGlobalRouting)) && service.equals(event.getSubject())) {
          notifyMessage(event.getTime(), (Message) event.getContents());
        }
      }
    });
View Full Code Here

        activityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                detailsModel.clear();

                Message m = (Message) tableModel.getValueAt(activityTable.getSelectedRow(), 1);

                for (Map.Entry<String, Object> entry : m.getParts().entrySet()) {
                    detailsModel.addPart(entry.getKey(), entry.getValue());
                }

                detailsModel.fireTableRowsUpdated(0, m.getParts().size() - 1);
                detailsModel.fireTableDataChanged();
            }
        });

        detailsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
View Full Code Here

    }

    public static Message uglyReEncode(Message message) {
        Map<String, Object> parts = (Map<String, Object>) JSONDecoder.decode(JSONEncoder.encode(message.getParts()));

        Message newMessage = CommandMessage.createWithParts(parts);
        if (parts.containsKey(SerializationParts.MARSHALLED_TYPES)) {
            TypeDemarshallHelper.demarshallAll((String) parts.get(SerializationParts.MARSHALLED_TYPES), newMessage);
        }
        return newMessage;
    }
View Full Code Here

    public static Message decodeAndDemarshall(String json) {
        Map<String, Object> parts = (Map<String, Object>) JSONDecoder.decode(json);

        if (parts == null) return CommandMessage.createWithParts(new HashMap());

        Message newMessage = CommandMessage.createWithParts(parts);

        for (Map.Entry<String, Object> entry : parts.entrySet()) {

        }
View Full Code Here

    if (!queueRunning) {
      JSONStreamEncoder.encode(new QueueStopMessage().getParts(), outstream);
      return;
    }

    Message m = null;

    checkSession();

    if (lock.tryAcquire()) {
      outstream.write('[');

      int payLoadSize = 0;
      try {

        if (wait) {
          m = queue.poll(45, TimeUnit.SECONDS);

        }
        else {
          m = queue.poll();
        }

        if (m instanceof HasEncoded) {
          outstream.write(((HasEncoded) m).getEncoded().getBytes());
        }
        else if (m instanceof QueueStopMessage) {
          JSONStreamEncoder.encode(m.getParts(), outstream);
          queueRunning = false;
          bus.closeQueue(this);
        }
        else if (m != null) {
          JSONStreamEncoder.encode(m.getParts(), outstream);
        }

        if (_windowPolling) {
          windowPolling = true;
          _windowPolling = false;
        }
        else if (windowPolling) {
          while (!queue.isEmpty() && payLoadSize < MAXIMUM_PAYLOAD_SIZE
              && !isWindowExceeded()) {
            outstream.write(',');
            if ((m = queue.poll()) instanceof HasEncoded) {
              outstream.write(((HasEncoded) m).getEncoded().getBytes());
            }
            else {
              JSONStreamEncoder.encode(m.getParts(), outstream);
            }
            payLoadSize++;

            try {
              if (queue.isEmpty())
View Full Code Here

      synchronized (queue) {
        if (deferredQueue.containsKey(queue)) {
          List<Message> deferredMessages = deferredQueue.get(queue);
          Iterator<Message> dmIter = deferredMessages.iterator();

          Message m;
          while (dmIter.hasNext()) {
            if ((m = dmIter.next()).hasPart(MessageParts.PriorityProcessing.toString())) {
              queue.offer(m);
              dmIter.remove();
            }
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.api.Message

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.