public final class MessageHeaders extends Object implements Map<String,Object>, Serializable
Message
IMPORTANT: This class is immutable. Any mutating operation
(e.g., put(..), putAll(..) etc.) will throw UnsupportedOperationException
.
To create MessageHeaders instance use fluent
MessageBuilder
API
MessageBuilder.withPayload("foo").setHeader("key1", "value1").setHeader("key2", "value2");or create an instance of GenericMessage passing payload as
Object
and headers as a regular Map
Map headers = new HashMap(); headers.put("key1", "value1"); headers.put("key2", "value2"); new GenericMessage("foo", headers);
MessageBuilder
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
MessageHeaders.AlternativeJdkIdGenerator
A variation of
UUID.randomUUID() that uses SecureRandom only for
the initial seed and Random thereafter, which provides better performance
in exchange for less securely random id's. |
static interface |
MessageHeaders.IdGenerator |
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_TYPE |
static String |
ERROR_CHANNEL |
static List<String> |
HEADER_NAMES |
static String |
ID
The key for the Message ID.
|
static String |
REPLY_CHANNEL |
static String |
TIMESTAMP |
Constructor and Description |
---|
MessageHeaders(Map<String,Object> headers) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Since MessageHeaders are immutable the call to this method will result in
UnsupportedOperationException |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,Object>> |
entrySet() |
boolean |
equals(Object object) |
Object |
get(Object key) |
<T> T |
get(Object key,
Class<T> type) |
Object |
getErrorChannel() |
UUID |
getId() |
Object |
getReplyChannel() |
Long |
getTimestamp() |
int |
hashCode() |
boolean |
isEmpty() |
Set<String> |
keySet() |
Object |
put(String key,
Object value)
Since MessageHeaders are immutable the call to this method will result in
UnsupportedOperationException |
void |
putAll(Map<? extends String,? extends Object> t)
Since MessageHeaders are immutable the call to this method will result in
UnsupportedOperationException |
Object |
remove(Object key)
Since MessageHeaders are immutable the call to this method will result in
UnsupportedOperationException |
int |
size() |
String |
toString() |
Collection<Object> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public static final String ID
public static final String TIMESTAMP
public static final String REPLY_CHANNEL
public static final String ERROR_CHANNEL
public static final String CONTENT_TYPE
public UUID getId()
public Long getTimestamp()
public Object getReplyChannel()
public Object getErrorChannel()
public int hashCode()
public boolean equals(Object object)
public boolean containsKey(Object key)
containsKey
in interface Map<String,Object>
public boolean containsValue(Object value)
containsValue
in interface Map<String,Object>
public Object put(String key, Object value)
UnsupportedOperationException
public void putAll(Map<? extends String,? extends Object> t)
UnsupportedOperationException
public Object remove(Object key)
UnsupportedOperationException
public void clear()
UnsupportedOperationException