Package org.cometd.bayeux
Interface Message
- All Known Subinterfaces:
Message.Mutable,ServerMessage,ServerMessage.Mutable
- All Known Implementing Classes:
HashMapMessage,ServerMessageImpl
public interface Message extends Map<String,Object>
The Bayeux protocol exchange information by means of messages.
This interface represents the API of a Bayeux message, and consists mainly of convenience methods to access the known fields of the message map.
This interface comes in both an immutable and mutable versions.
Mutability may be deeply enforced by an implementation, so that it is not correct
to cast a passed Message, to a Message.Mutable, even if the implementation
allows this.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceMessage.MutableThe mutable version of aMessage -
Field Summary
Fields Modifier and Type Field Description static StringADVICE_FIELDstatic StringCHANNEL_FIELDstatic StringCLIENT_ID_FIELDstatic StringCONNECTION_TYPE_FIELDstatic StringDATA_FIELDstatic StringERROR_FIELDstatic StringEXT_FIELDstatic StringID_FIELDstatic StringINTERVAL_FIELDstatic StringMAX_INTERVAL_FIELDstatic StringMIN_VERSION_FIELDstatic StringRECONNECT_FIELDstatic StringRECONNECT_HANDSHAKE_VALUEstatic StringRECONNECT_NONE_VALUEstatic StringRECONNECT_RETRY_VALUEstatic StringSUBSCRIPTION_FIELDstatic StringSUCCESSFUL_FIELDstatic StringSUPPORTED_CONNECTION_TYPES_FIELDstatic StringTIMEOUT_FIELDstatic StringTIMESTAMP_FIELDstatic StringTRANSPORT_FIELDstatic StringVERSION_FIELD -
Method Summary
Modifier and Type Method Description Map<String,Object>getAdvice()Convenience method to retrieve theADVICE_FIELDStringgetChannel()Convenience method to retrieve theCHANNEL_FIELD.ChannelIdgetChannelId()Convenience method to retrieve theCHANNEL_FIELD.StringgetClientId()Convenience method to retrieve theCLIENT_ID_FIELDObjectgetData()Convenience method to retrieve theDATA_FIELDMap<String,Object>getDataAsMap()Map<String,Object>getExt()Convenience method to retrieve theEXT_FIELDStringgetId()Convenience method to retrieve theID_FIELDStringgetJSON()booleanisMeta()A messages that has a meta channel is dubbed a "meta message".booleanisPublishReply()Publish message replies contain the "successful" fieldbooleanisSuccessful()Convenience method to retrieve theSUCCESSFUL_FIELDMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Field Details
-
CLIENT_ID_FIELD
- See Also:
- Constant Field Values
-
DATA_FIELD
- See Also:
- Constant Field Values
-
CHANNEL_FIELD
- See Also:
- Constant Field Values
-
ID_FIELD
- See Also:
- Constant Field Values
-
ERROR_FIELD
- See Also:
- Constant Field Values
-
TIMESTAMP_FIELD
- See Also:
- Constant Field Values
-
TRANSPORT_FIELD
- See Also:
- Constant Field Values
-
ADVICE_FIELD
- See Also:
- Constant Field Values
-
SUCCESSFUL_FIELD
- See Also:
- Constant Field Values
-
SUBSCRIPTION_FIELD
- See Also:
- Constant Field Values
-
EXT_FIELD
- See Also:
- Constant Field Values
-
CONNECTION_TYPE_FIELD
- See Also:
- Constant Field Values
-
VERSION_FIELD
- See Also:
- Constant Field Values
-
MIN_VERSION_FIELD
- See Also:
- Constant Field Values
-
SUPPORTED_CONNECTION_TYPES_FIELD
- See Also:
- Constant Field Values
-
RECONNECT_FIELD
- See Also:
- Constant Field Values
-
INTERVAL_FIELD
- See Also:
- Constant Field Values
-
MAX_INTERVAL_FIELD
- See Also:
- Constant Field Values
-
TIMEOUT_FIELD
- See Also:
- Constant Field Values
-
RECONNECT_RETRY_VALUE
- See Also:
- Constant Field Values
-
RECONNECT_HANDSHAKE_VALUE
- See Also:
- Constant Field Values
-
RECONNECT_NONE_VALUE
- See Also:
- Constant Field Values
-
-
Method Details
-
getAdvice
Convenience method to retrieve theADVICE_FIELD- Returns:
- the advice of the message
-
getChannel
String getChannel()Convenience method to retrieve theCHANNEL_FIELD. Bayeux message always have a non null channel.- Returns:
- the channel of the message
-
getChannelId
ChannelId getChannelId()Convenience method to retrieve theCHANNEL_FIELD. Bayeux message always have a non null channel.- Returns:
- the channel of the message
-
getClientId
String getClientId()Convenience method to retrieve theCLIENT_ID_FIELD- Returns:
- the client id of the message
-
getData
Object getData()Convenience method to retrieve theDATA_FIELD- Returns:
- the data of the message
- See Also:
getDataAsMap()
-
isMeta
boolean isMeta()A messages that has a meta channel is dubbed a "meta message".- Returns:
- whether the channel's message is a meta channel
-
isPublishReply
boolean isPublishReply()Publish message replies contain the "successful" field- Returns:
- whether this message is a publish reply (as opposed to a published message)
-
isSuccessful
boolean isSuccessful()Convenience method to retrieve theSUCCESSFUL_FIELD- Returns:
- whether the message is successful
-
getDataAsMap
- Returns:
- the data of the message as a map
- See Also:
getData()
-
getExt
Convenience method to retrieve theEXT_FIELD- Returns:
- the ext of the message
-
getId
String getId()Convenience method to retrieve theID_FIELD- Returns:
- the id of the message
-
getJSON
String getJSON()- Returns:
- this message as a JSON string
-