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

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


   * @return a <tt>MessageBuildSubject</tt> which essentially is a <tt>Message</tt>, but ensures that the user
   *         constructs messages properly
   */
  @SuppressWarnings({ "unchecked" })
  public static MessageBuildSubject<MessageReplySendable> createConversation(final Message message) {
    final Message newMessage = provider.get();
    newMessage.setFlag(RoutingFlag.NonGlobalRouting);
    if (newMessage instanceof HasEncoded) {
      return new DefaultMessageBuilder<MessageReplySendable>(new HasEncodedConvMessageWrapper(message, newMessage))
          .start();
    }
    else {
View Full Code Here


   * @return a <tt>MessageBuildSubject</tt> which essentially is a <tt>Message</tt>, but ensures that the user
   *         constructs messages properly
   */
  @SuppressWarnings({ "unchecked" })
  public static MessageBuildCommand<MessageReplySendable> createConversation(final Message message, final String subject) {
    final Message newMessage = provider.get();
    if (newMessage instanceof HasEncoded) {
      return new DefaultMessageBuilder<MessageReplySendable>(new HasEncodedConvMessageWrapper(message, newMessage))
          .start()
          .toSubject(subject);
    }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Message createCommandMessage(QueueSession session, String json) {
    if (json.length() == 0) return null;

    Message msg = createWithPartsFromRawMap(ErraiProtocolEnvelopeMarshaller.INSTANCE.demarshall(JSONDecoder.decode(json),
        new DecodingSession(MappingContextSingleton.get())))
            .setResource("Session", session)
            .setResource("SessionID", session.getSessionId());

    msg.setFlag(RoutingFlag.FromRemote);

    return msg;
  }
View Full Code Here

            new DecodingSession(MappingContextSingleton.get()));
  }

  @SuppressWarnings("unchecked")
  private static Message from(Map parts, QueueSession session, HttpServletRequest request) {
    Message msg = createWithParts(parts)
            .setResource("Session", session)
            .setResource("SessionID", session.getSessionId())
            .setResource(HttpServletRequest.class.getName(), request);
    msg.setFlag(RoutingFlag.FromRemote);
    return msg;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Message createCommandMessage(QueueSession session, String json) {
    if (json.length() == 0) return null;

    Message msg = createWithPartsFromRawMap(ErraiProtocolEnvelopeMarshaller.INSTANCE.demarshall(JSONDecoder.decode(json),
        new DecodingSession(MappingContextSingleton.get())))
            .setResource("Session", session)
            .setResource("SessionID", session.getSessionId());

    msg.setFlag(RoutingFlag.FromRemote);

    return msg;
  }
View Full Code Here

            new DecodingSession(MappingContextSingleton.get()));
  }

  @SuppressWarnings("unchecked")
  private static Message from(Map parts, QueueSession session, HttpServletRequest request) {
    Message msg = createWithParts(parts)
            .setResource("Session", session)
            .setResource("SessionID", session.getSessionId())
            .setResource(HttpServletRequest.class.getName(), request);
    msg.setFlag(RoutingFlag.FromRemote);
    return msg;
  }
View Full Code Here

      }
    }
    else {
      // this is an active session. send the message.;

      final Message msg = MessageFactory.createCommandMessage(cometSession, text);
      msg.setResource(HttpServletRequest.class.getName(), socket.getServletRequest());
      service.store(msg);
    }
  }
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

TOP

Related Classes of org.jboss.errai.bus.client.api.messaging.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.