spring-framework / org.springframework.messaging.simp.stomp / StompHeaderAccessor

StompHeaderAccessor

open class StompHeaderAccessor : SimpMessageHeaderAccessor

A MessageHeaderAccessor to use when creating a Message from a decoded STOMP frame, or when encoding a Message to a STOMP frame.

When created from STOMP frame content, the actual STOMP headers are stored in the native header sub-map managed by the parent class org.springframework.messaging.support.NativeMessageHeaderAccessor while the parent class SimpMessageHeaderAccessor manages common processing headers some of which are based on STOMP headers (e.g. destination, content-type, etc).

An instance of this class can also be created by wrapping an existing Message. That message may have been created with the more generic org.springframework.messaging.simp.SimpMessageHeaderAccessor in which case STOMP headers are created from common processing headers. In this case it is also necessary to invoke either #updateStompCommandAsClientMessage() or #updateStompCommandAsServerMessage() if sending a message and depending on whether a message is sent to a client or the message broker.

Author
Rossen Stoyanchev

Since
4.0

Properties

STOMP_ACCEPT_VERSION_HEADER

static val STOMP_ACCEPT_VERSION_HEADER: String

STOMP_ACK_HEADER

static val STOMP_ACK_HEADER: String

STOMP_CONTENT_LENGTH_HEADER

static val STOMP_CONTENT_LENGTH_HEADER: String

STOMP_CONTENT_TYPE_HEADER

static val STOMP_CONTENT_TYPE_HEADER: String

STOMP_DESTINATION_HEADER

static val STOMP_DESTINATION_HEADER: String

STOMP_HEARTBEAT_HEADER

static val STOMP_HEARTBEAT_HEADER: String

STOMP_HOST_HEADER

static val STOMP_HOST_HEADER: String

STOMP_ID_HEADER

static val STOMP_ID_HEADER: String

STOMP_LOGIN_HEADER

static val STOMP_LOGIN_HEADER: String

STOMP_MESSAGE_HEADER

static val STOMP_MESSAGE_HEADER: String

STOMP_MESSAGE_ID_HEADER

static val STOMP_MESSAGE_ID_HEADER: String

STOMP_NACK_HEADER

static val STOMP_NACK_HEADER: String

STOMP_PASSCODE_HEADER

static val STOMP_PASSCODE_HEADER: String

STOMP_RECEIPT_HEADER

static val STOMP_RECEIPT_HEADER: String

STOMP_RECEIPT_ID_HEADER

static val STOMP_RECEIPT_ID_HEADER: String

STOMP_SUBSCRIPTION_HEADER

static val STOMP_SUBSCRIPTION_HEADER: String

STOMP_VERSION_HEADER

static val STOMP_VERSION_HEADER: String

Functions

create

open static fun create(command: StompCommand): StompHeaderAccessor

Create an instance for the given STOMP command.

open static fun create(command: StompCommand, headers: MutableMap<String, MutableList<String>>): StompHeaderAccessor

Create an instance for the given STOMP command and headers.

createForHeartbeat

open static fun createForHeartbeat(): StompHeaderAccessor

Create headers for a heartbeat. While a STOMP heartbeat frame does not have headers, a session id is needed for processing purposes at a minimum.

getAcceptVersion

open fun getAcceptVersion(): MutableSet<String>

getAck

open fun getAck(): String

getCommand

open fun getCommand(): StompCommand

Return the STOMP command, or null if not yet set.

open static fun getCommand(headers: MutableMap<String, Any>): StompCommand

Return the STOMP command from the given headers, or null if not set.

getContentLength

open fun getContentLength(): Int
open static fun getContentLength(nativeHeaders: MutableMap<String, MutableList<String>>): Int

getDetailedLogMessage

open fun getDetailedLogMessage(payload: Any): String

getHeartbeat

open fun getHeartbeat(): LongArray

getHost

open fun getHost(): String

getLogin

open fun getLogin(): String

getMessage

open fun getMessage(): String

getMessageId

open fun getMessageId(): String

getNack

open fun getNack(): String

getPasscode

open fun getPasscode(): String
open static fun getPasscode(headers: MutableMap<String, Any>): String

Return the passcode header value, or null if not set.

getReceipt

open fun getReceipt(): String

getReceiptId

open fun getReceiptId(): String

getShortLogMessage

open fun getShortLogMessage(payload: Any): String

getVersion

open fun getVersion(): String

isHeartbeat

open fun isHeartbeat(): Boolean

setAcceptVersion

open fun setAcceptVersion(acceptVersion: String): Unit

setAck

open fun setAck(ack: String): Unit

setContentLength

open fun setContentLength(contentLength: Int): Unit

setContentType

open fun setContentType(contentType: MimeType): Unit

setDestination

open fun setDestination(destination: String): Unit

setHeartbeat

open fun setHeartbeat(cx: Long, cy: Long): Unit

setHost

open fun setHost(host: String): Unit

setLogin

open fun setLogin(login: String): Unit

setMessage

open fun setMessage(content: String): Unit

setMessageId

open fun setMessageId(id: String): Unit

setNack

open fun setNack(nack: String): Unit

setPasscode

open fun setPasscode(passcode: String): Unit

setReceipt

open fun setReceipt(receiptId: String): Unit

setReceiptId

open fun setReceiptId(receiptId: String): Unit

setSubscriptionId

open fun setSubscriptionId(subscriptionId: String): Unit

setVersion

open fun setVersion(version: String): Unit

updateStompCommandAsClientMessage

open fun updateStompCommandAsClientMessage(): StompCommand

updateStompCommandAsServerMessage

open fun updateStompCommandAsServerMessage(): Unit

wrap

open static fun wrap(message: Message<*>): StompHeaderAccessor

Create an instance from the payload and headers of the given Message.