Examples of CommandMessage


Examples of org.axonframework.commandhandling.CommandMessage

     * @param command  The command to dispatch
     * @param callback The callback to notify with the processing result
     * @param <R>      The type of response expected from the command
     */
    protected <R> void send(Object command, CommandCallback<R> callback) {
        CommandMessage commandMessage = processInterceptors(createCommandMessage(command));
        CommandCallback<R> commandCallback = callback;
        if (retryScheduler != null) {
            commandCallback = new RetryingCallback<R>(callback, commandMessage, retryScheduler, commandBus);
        }
        commandBus.dispatch(commandMessage, commandCallback);
View Full Code Here

Examples of org.axonframework.commandhandling.CommandMessage

     *
     * @param commandMessage The incoming command message
     * @return The command message to dispatch
     */
    protected CommandMessage processInterceptors(CommandMessage commandMessage) {
        CommandMessage message = commandMessage;
        for (CommandDispatchInterceptor dispatchInterceptor : dispatchInterceptors) {
            message = dispatchInterceptor.handle(message);
        }
        return message;
    }
View Full Code Here

Examples of org.jboss.errai.bus.client.CommandMessage

        for (int i = 0; i < pkg.length; i++) {
            Map<String, Object> parts = decodeToMap(pkg[i]);
            parts.remove(MessageParts.SessionID.name());

            CommandMessage msg = CommandMessage.create().setParts(parts);
            msg.setResource("Session", session);

            if (parts.containsKey("__MarshalledTypes")) {
                TypeDemarshallHelper.demarshallAll((String) parts.get("__MarshalledTypes"), msg);
            }
View Full Code Here

Examples of org.jboss.errai.bus.client.CommandMessage

                            }
                        }

                        handler.doLogin(credentials);

                        CommandMessage challenge = CommandMessage.create()
                                .toSubject("AuthorizationService")
                                .command(SecurityCommands.AuthRequest)
                                .set(SecurityParts.ReplyTo, SUBJECT);

                        for (int i = 0; i < credentialNames.length; i++) {
                            switch (CredentialTypes.valueOf(credentialNames[i])) {
                                case Name:
                                    challenge.set(CredentialTypes.Name, credentials[i].getValue());
                                    break;
                                case Password:
                                    challenge.set(CredentialTypes.Password, credentials[i].getValue());
                                    break;
                            }
                        }

                        challenge.sendNowWith(ErraiBus.get());
                       
                        break;

                    case SecurityResponse:
                        String name = msg.get(String.class, SecurityParts.Name);
View Full Code Here

Examples of org.jboss.errai.bus.client.api.base.CommandMessage

    }
  };


  public static Message decodeCommandMessage(Object value) {
    CommandMessage msg = CommandMessage.createWithParts(decodePayload(value));
    msg.setResource(RequestDispatcher.class.getName(), requestDispatcherProvider);
    msg.setResource("Session", clientSession);
    return msg;
  }
View Full Code Here

Examples of org.jboss.errai.bus.client.api.base.CommandMessage

                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, subjects)
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              final CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              StringBuilder capabilitiesBuffer = new StringBuilder(25);

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */
                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());
                msg.set(MessageParts.WebSocketURL, "ws://" + request.getLocalAddr()
                        + ":" + webSocketPort + webSocketPath);

                String connectionToken = SecureHashUtil.nextSecureHash("SHA-256", session.getSessionId());
                session.setAttribute(MessageParts.WebSocketToken.name(), connectionToken);
                msg.set(MessageParts.WebSocketToken, connectionToken);
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here

Examples of org.jboss.errai.bus.client.api.base.CommandMessage

                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, subjects)
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              StringBuilder capabilitiesBuffer = new StringBuilder();

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */
                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());
                msg.set(MessageParts.WebSocketURL, "ws://" + request.getLocalAddr()
                        + ":" + webSocketPort + webSocketPath);

                String connectionToken = SecureHashUtil.nextSecureHash("SHA-256", session.getSessionId());
                session.setAttribute(MessageParts.WebSocketToken.name(), connectionToken);
                msg.set(MessageParts.WebSocketToken, connectionToken);
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here

Examples of org.jboss.errai.bus.client.api.base.CommandMessage

    }
  };


  public static Message decodeCommandMessage(Object value) {
    CommandMessage msg = CommandMessage.createWithParts(decodePayload(value));
    msg.setResource(RequestDispatcher.class.getName(), requestDispatcherProvider);
    msg.setResource("Session", clientSession);
    return msg;
  }
View Full Code Here

Examples of org.jboss.errai.bus.client.api.base.CommandMessage

    }

    consumeEventFromMessage(CommandMessage.createWithParts(messageMap));

    if (isRemoteCommunicationEnabled()) {
      final CommandMessage withParts = CommandMessage.createWithParts(messageMap);
      messageMap.put(MessageParts.ToSubject.name(), SERVER_DISPATCHER_SUBJECT);

      fireOnSubscribe(beanRef.getClass().getName(), withParts);
    }
  }
View Full Code Here

Examples of org.jboss.errai.bus.client.api.base.CommandMessage

                      .command(BusCommands.RemoteSubscribe)
                      .with(MessageParts.SubjectsList, subjects)
                      .with(MessageParts.PriorityProcessing, "1")
                      .noErrorHandling().sendNowWith(ServerMessageBusImpl.this, false);

              CommandMessage msg = ConversationMessage.create(message);
              msg.toSubject(BuiltInServices.ClientBus.name())
                      .command(BusCommands.CapabilitiesNotice);

              StringBuilder capabilitiesBuffer = new StringBuilder();

              boolean first;
              if (ErraiServiceConfigurator.LONG_POLLING) {
                capabilitiesBuffer.append(Capabilities.LongPollAvailable.name());
                first = false;
              }
              else {
                capabilitiesBuffer.append(Capabilities.NoLongPollAvailable.name());
                first = false;
                msg.set(MessageParts.PollFrequency, ErraiServiceConfigurator.HOSTED_MODE_TESTING ? 50 : 250);
              }

              if (webSocketServer) {
                if (!first) {
                  capabilitiesBuffer.append(',');
                }
                capabilitiesBuffer.append(Capabilities.WebSockets.name());
                /**
                 * Advertise where the client can find a websocket.
                 */
                HttpServletRequest request = message.getResource(HttpServletRequest.class, HttpServletRequest.class.getName());
                msg.set(MessageParts.WebSocketURL, "ws://" + request.getLocalAddr()
                        + ":" + webSocketPort + webSocketPath);

                String connectionToken = SecureHashUtil.nextSecureHash("SHA-256", session.getSessionId());
                session.setAttribute(MessageParts.WebSocketToken.name(), connectionToken);
                msg.set(MessageParts.WebSocketToken, connectionToken);
              }

              msg.set(MessageParts.CapabilitiesFlags, capabilitiesBuffer.toString());

              send(msg, false);

              createConversation(message)
                      .toSubject(BuiltInServices.ClientBus.name())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.