public interface Message
Message interface is the root interface of all OMS messages, and the most commonly used OMS message is
BytesMessage.
Most message-oriented middleware (MOM) products treat messages as lightweight entities that consist of header and body and is used by separate applications to exchange a piece of information, like Apache RocketMQ.
The header contains fields used by the messaging system that describes the message's meta information, like QoS level, origin, destination, and so on, while the body contains the application data being transmitted.
As for the header, OMS defines two kinds types: System Header and User Header, with respect to flexibility in vendor implementation and user usage.
In BytesMessage, the body is just a byte array, may be compressed and uncompressed
in the transmitting process by the messaging system.
The application is responsible for explaining the concrete content and format of the message body,
OMS is never aware of that.
The body part is placed in the implementation classes of Message.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Message.BuiltinKeys |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getBody(Class<T> type)
Get message body
|
Message |
putSysHeaders(String key,
double value)
Puts a
String-double KeyValue entry to the system headers of a Message. |
Message |
putSysHeaders(String key,
int value)
Puts a
String-int KeyValue entry to the system headers of a Message. |
Message |
putSysHeaders(String key,
long value)
Puts a
String-long KeyValue entry to the system headers of a Message. |
Message |
putSysHeaders(String key,
String value)
Puts a
String-String KeyValue entry to the system headers of a Message. |
Message |
putUserHeaders(String key,
double value)
Puts a
String-double KeyValue entry to the user headers of a Message. |
Message |
putUserHeaders(String key,
int value)
Puts a
String-int KeyValue entry to the user headers of a Message. |
Message |
putUserHeaders(String key,
long value)
Puts a
String-long KeyValue entry to the user headers of a Message. |
Message |
putUserHeaders(String key,
String value)
Puts a
String-String KeyValue entry to the user headers of a Message. |
KeyValue |
sysHeaders()
Returns all the system header fields of the
Message object as a KeyValue. |
KeyValue |
userHeaders()
Returns all the customized user header fields of the
Message object as a KeyValue. |
KeyValue sysHeaders()
Message object as a KeyValue.MessageMessage.BuiltinKeysKeyValue userHeaders()
Message object as a KeyValue.MessageMessage putSysHeaders(String key, int value)
String-int KeyValue entry to the system headers of a Message.key - the key to be placed into the system headersvalue - the value corresponding to keyMessage putSysHeaders(String key, long value)
String-long KeyValue entry to the system headers of a Message.key - the key to be placed into the system headersvalue - the value corresponding to keyMessage putSysHeaders(String key, double value)
String-double KeyValue entry to the system headers of a Message.key - the key to be placed into the system headersvalue - the value corresponding to keyMessage putSysHeaders(String key, String value)
String-String KeyValue entry to the system headers of a Message.key - the key to be placed into the system headersvalue - the value corresponding to keyMessage putUserHeaders(String key, int value)
String-int KeyValue entry to the user headers of a Message.key - the key to be placed into the user headersvalue - the value corresponding to keyMessage putUserHeaders(String key, long value)
String-long KeyValue entry to the user headers of a Message.key - the key to be placed into the user headersvalue - the value corresponding to keyMessage putUserHeaders(String key, double value)
String-double KeyValue entry to the user headers of a Message.key - the key to be placed into the user headersvalue - the value corresponding to keyMessage putUserHeaders(String key, String value)
String-String KeyValue entry to the user headers of a Message.key - the key to be placed into the user headersvalue - the value corresponding to key<T> T getBody(Class<T> type) throws OMSMessageFormatException
T - Generic typetype - Message body typeOMSMessageFormatException - if the message body cannot be assigned to the specified typeCopyright © 2017–2018 OpenMessaging. All rights reserved.