コード例 #1
0
 private void updateStompHeadersFromSimpMessageHeaders() {
   if (getDestination() != null) {
     setNativeHeader(STOMP_DESTINATION_HEADER, getDestination());
   }
   if (getContentType() != null) {
     setNativeHeader(STOMP_CONTENT_TYPE_HEADER, getContentType().toString());
   }
   trySetStompHeaderForSubscriptionId();
 }
コード例 #2
0
  public void updateStompCommandAsServerMessage() {

    Assert.state(
        SimpMessageType.MESSAGE.equals(getMessageType()),
        "Unexpected message type " + getMessage());

    StompCommand command = getCommand();
    if ((command == null) || StompCommand.SEND.equals(command)) {
      setHeader(COMMAND_HEADER, StompCommand.MESSAGE);
    } else if (!StompCommand.MESSAGE.equals(command)) {
      throw new IllegalStateException("Unexpected STOMP command " + command);
    }

    trySetStompHeaderForSubscriptionId();

    if (getMessageId() == null) {
      String messageId = getSessionId() + "-" + messageIdCounter.getAndIncrement();
      setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId);
    }
  }
コード例 #3
0
 @Override
 public void setSubscriptionId(String subscriptionId) {
   super.setSubscriptionId(subscriptionId);
   trySetStompHeaderForSubscriptionId();
 }