Package org.springframework.messaging.simp

Examples of org.springframework.messaging.simp.SimpMessageType


     * @return the {@link Constraint} associated to the matchers.
     */
    public Constraint typeMatchers(SimpMessageType... typesToMatch) {
        MessageMatcher<?>[] typeMatchers = new MessageMatcher<?>[typesToMatch.length];
        for (int i = 0; i < typesToMatch.length; i++) {
            SimpMessageType typeToMatch = typesToMatch[i];
            typeMatchers[i] = new SimpMessageTypeMatcher(typeToMatch);
        }
        return matchers(typeMatchers);
    }
View Full Code Here


        this.typeToMatch = typeToMatch;
    }

    public boolean matches(Message<? extends Object> message) {
        MessageHeaders headers = message.getHeaders();
        SimpMessageType messageType = SimpMessageHeaderAccessor
                .getMessageType(headers);

        return typeToMatch == messageType;
    }
View Full Code Here


  @Override
  public final void registerSubscription(Message<?> message) {
    MessageHeaders headers = message.getHeaders();
    SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers);
    Assert.isTrue(SimpMessageType.SUBSCRIBE.equals(messageType), "Expected SUBSCRIBE: " + message);
    String sessionId = SimpMessageHeaderAccessor.getSessionId(headers);
    if (sessionId == null) {
      logger.error("No sessionId in  " + message);
      return;
View Full Code Here

      String destination, Message<?> message);

  @Override
  public final void unregisterSubscription(Message<?> message) {
    MessageHeaders headers = message.getHeaders();
    SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers);
    Assert.isTrue(SimpMessageType.UNSUBSCRIBE.equals(messageType), "Expected UNSUBSCRIBE: " + message);
    String sessionId = SimpMessageHeaderAccessor.getSessionId(headers);
    if (sessionId == null) {
      logger.error("No sessionId in " + message);
      return;
View Full Code Here

  public abstract void unregisterAllSubscriptions(String sessionId);

  @Override
  public final MultiValueMap<String, String> findSubscriptions(Message<?> message) {
    MessageHeaders headers = message.getHeaders();
    SimpMessageType type = SimpMessageHeaderAccessor.getMessageType(headers);
    Assert.isTrue(SimpMessageType.MESSAGE.equals(type), "Unexpected message type: " + type);
    String destination = SimpMessageHeaderAccessor.getDestination(headers);
    if (destination == null) {
      logger.error("No destination in " + message);
      return null;
View Full Code Here

  @Override
  protected void handleMessageInternal(Message<?> message) {

    MessageHeaders headers = message.getHeaders();
    SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers);
    String destination = SimpMessageHeaderAccessor.getDestination(headers);
    String sessionId = SimpMessageHeaderAccessor.getSessionId(headers);

    if (!checkDestinationPrefix(destination)) {
      return;
View Full Code Here

    if (subscriptionId != null) {
      if (getCommand() != null && StompCommand.MESSAGE.equals(getCommand())) {
        setNativeHeader(STOMP_SUBSCRIPTION_HEADER, subscriptionId);
      }
      else {
        SimpMessageType messageType = getMessageType();
        if (SimpMessageType.SUBSCRIBE.equals(messageType) || SimpMessageType.UNSUBSCRIBE.equals(messageType)) {
          setNativeHeader(STOMP_ID_HEADER, subscriptionId);
        }
      }
    }
View Full Code Here

  private class UnsentDisconnectChannelInterceptor extends ChannelInterceptorAdapter {

    @Override
    public void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex) {
      if (!sent) {
        SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(message.getHeaders());
        if (SimpMessageType.DISCONNECT.equals(messageType)) {
          logger.debug("Detected unsent DISCONNECT message. Processing anyway.");
          handleMessage(message);
        }
      }
View Full Code Here

    if (!isBrokerAvailable()) {
      if (sessionId == null || SYSTEM_SESSION_ID.equals(sessionId)) {
        throw new MessageDeliveryException("Message broker not active. Consider subscribing to " +
            "receive BrokerAvailabilityEvent's from an ApplicationListener Spring bean.");
      }
      SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(message.getHeaders());
      if (logger.isErrorEnabled() && SimpMessageType.CONNECT.equals(messageType)) {
        logger.error("Broker not active. Ignoring " + message);
      }
      else if (logger.isDebugEnabled()) {
        logger.debug("Broker not active. Ignoring " + message);
View Full Code Here

    return new UserDestinationResult(destination, resolved, info.getSubscribeDestination(), info.getUser());
  }

  private DestinationInfo parseUserDestination(Message<?> message) {
    MessageHeaders headers = message.getHeaders();
    SimpMessageType messageType = SimpMessageHeaderAccessor.getMessageType(headers);
    String destination = SimpMessageHeaderAccessor.getDestination(headers);
    Principal principal = SimpMessageHeaderAccessor.getUser(headers);
    String sessionId = SimpMessageHeaderAccessor.getSessionId(headers);

    String destinationWithoutPrefix;
View Full Code Here

TOP

Related Classes of org.springframework.messaging.simp.SimpMessageType

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.