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); } }
@Override public String getShortLogMessage(Object payload) { if (StompCommand.SUBSCRIBE.equals(getCommand())) { return "SUBSCRIBE " + getDestination() + " id=" + getSubscriptionId() + appendSession(); } else if (StompCommand.UNSUBSCRIBE.equals(getCommand())) { return "UNSUBSCRIBE id=" + getSubscriptionId() + appendSession(); } else if (StompCommand.SEND.equals(getCommand())) { return "SEND " + getDestination() + appendSession() + appendPayload(payload); } else if (StompCommand.CONNECT.equals(getCommand())) { return "CONNECT" + (getUser() != null ? " user="******"") + appendSession(); } else if (StompCommand.CONNECTED.equals(getCommand())) { return "CONNECTED heart-beat=" + Arrays.toString(getHeartbeat()) + appendSession(); } else if (StompCommand.DISCONNECT.equals(getCommand())) { return "DISCONNECT" + (getReceipt() != null ? " receipt=" + getReceipt() : "") + appendSession(); } else { return getDetailedLogMessage(payload); } }