SimpMessageHeaderAccessor

A base class for working with message headers in simple messaging protocols that support basic messaging patterns. Provides uniform access to specific values common across protocols such as a destination, message type (e.g. publish, subscribe, etc), session id, and others.

<p>Use one of the static factory method in this class, then call getters and setters, and at the end if necessary call {@link #toMap()} to obtain the updated headers.

@author Rossen Stoyanchev @since 4.0

class SimpMessageHeaderAccessor : NativeMessageHeaderAccessor {}

Constructors

this
this(SimpMessageType messageType, Map!(string, List!string) externalSourceHeaders)

A constructor for creating new message headers. This constructor is protected. See factory methods in this and sub-classes.

this
this(MessageBase message)

A constructor for accessing and modifying existing message headers. This constructor is protected. See factory methods in this and sub-classes.

Members

Functions

createAccessor
MessageHeaderAccessor createAccessor(MessageBase message)
Undocumented in source. Be warned that the author may not have intended to support it.
getDestination
string getDestination()
Undocumented in source. Be warned that the author may not have intended to support it.
getDetailedLogMessage
string getDetailedLogMessage(Object payload)
Undocumented in source. Be warned that the author may not have intended to support it.
getMessageType
Nullable!SimpMessageType getMessageType()
Undocumented in source. Be warned that the author may not have intended to support it.
getSessionAttributes
Map!(string, Object) getSessionAttributes()

Return the attributes associated with the current session.

getSessionId
string getSessionId()

Return the id of the current session.

getShortLogMessage
string getShortLogMessage(Object payload)

Return the user associated with the current session.

getSubscriptionId
string getSubscriptionId()
Undocumented in source. Be warned that the author may not have intended to support it.
setDestination
void setDestination(string destination)
Undocumented in source. Be warned that the author may not have intended to support it.
setMessageTypeIfNotSet
void setMessageTypeIfNotSet(SimpMessageType messageType)
Undocumented in source. Be warned that the author may not have intended to support it.
setSessionAttributes
void setSessionAttributes(Map!(string, Object) attributes)

A static alternative for access to the session attributes header.

setSessionId
void setSessionId(int sessionId)
Undocumented in source. Be warned that the author may not have intended to support it.
setSessionId
void setSessionId(string sessionId)
Undocumented in source. Be warned that the author may not have intended to support it.
setSubscriptionId
void setSubscriptionId(string subscriptionId)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

create
SimpMessageHeaderAccessor create()

Create an instance with {@link hunt.stomp.simp.SimpMessageType} {@code MESSAGE}.

create
SimpMessageHeaderAccessor create(SimpMessageType messageType)

Create an instance with the given {@link hunt.stomp.simp.SimpMessageType}.

getDestination
string getDestination(Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
getHeartbeat
long[] getHeartbeat(Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
getMessageType
Nullable!SimpMessageType getMessageType(Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
getSessionAttributes
Map!(string, Object) getSessionAttributes(Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
getSessionId
string getSessionId(Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
getSubscriptionId
string getSubscriptionId(Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
wrap
SimpMessageHeaderAccessor wrap(MessageBase message)

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

Variables

CONNECT_MESSAGE_HEADER
enum string CONNECT_MESSAGE_HEADER;
Undocumented in source.
DESTINATION_HEADER
enum string DESTINATION_HEADER;
Undocumented in source.
DISCONNECT_MESSAGE_HEADER
enum string DISCONNECT_MESSAGE_HEADER;
Undocumented in source.
HEART_BEAT_HEADER
enum string HEART_BEAT_HEADER;
Undocumented in source.
IGNORE_ERROR
enum string IGNORE_ERROR;

A header that indicates to the broker that the sender will ignore errors. The header is simply checked for presence or absence.

MESSAGE_TYPE_HEADER
enum string MESSAGE_TYPE_HEADER;
Undocumented in source.
ORIGINAL_DESTINATION
enum string ORIGINAL_DESTINATION;

A header for internal use with "user" destinations where we need to restore the destination prior to sending messages to clients.

SESSION_ATTRIBUTES
enum string SESSION_ATTRIBUTES;
Undocumented in source.
SESSION_ID_HEADER
enum string SESSION_ID_HEADER;
Undocumented in source.
SUBSCRIPTION_ID_HEADER
enum string SUBSCRIPTION_ID_HEADER;
Undocumented in source.
USER_HEADER
enum string USER_HEADER;
Undocumented in source.

Inherited Members

From NativeMessageHeaderAccessor

NATIVE_HEADERS
enum string NATIVE_HEADERS;

The header name used to store native headers.

getNativeHeaders
MultiStringsMap getNativeHeaders()
Undocumented in source. Be warned that the author may not have intended to support it.
toNativeHeaderMap
MultiStringsMap toNativeHeaderMap()

Return a copy of the native header values or an empty map.

setImmutable
void setImmutable()
Undocumented in source. Be warned that the author may not have intended to support it.
containsNativeHeader
bool containsNativeHeader(string headerName)

Whether the native header map contains the give header name.

getNativeHeader
List!(string) getNativeHeader(string headerName)

Return all values for the specified native header. or {@code null} if none.

getFirstNativeHeader
string getFirstNativeHeader(string headerName)

Return the first value for the specified native header, or {@code null} if none.

setNativeHeader
void setNativeHeader(string name, string value)

Set the specified native header value replacing existing values.

addNativeHeader
void addNativeHeader(string name, string value)

Add the specified native header value to existing values.

addNativeHeaders
void addNativeHeaders(MultiValueMap!(string, string) headers)
Undocumented in source. Be warned that the author may not have intended to support it.
removeNativeHeader
List!(string) removeNativeHeader(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
getFirstNativeHeader
string getFirstNativeHeader(string headerName, Map!(string, Object) headers)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta