public interface XMessage extends Closeable
Modifier and Type | Method and Description |
---|---|
<P> void |
addMessageProperty(String key,
P value)
Add a message property - i.e.
|
void |
addPayloadToRelease(XMessageFormat payload)
Associate
XMessageFormat (i.e : payload ) with XMessage in order to GC with
XMessage resulting any XMessageFormat s obtained from File Store to release with it. |
<H> void |
addTransportHeader(String key,
H value)
Add a transport header to this message
|
XMessage |
cloneFullMessage()
Creates a clone of the message including the clone of payload as well as clones of attachments if any
|
XMessage |
cloneMessageWithoutPayload()
Creates a clone of the message without the payload and attachments.
|
Optional<XAttachment> |
getAttachment(String key)
Retrieves the XAttachment with the given key
|
Map<String,XAttachment> |
getAttachments()
Return current attachments as an unmodifiable map
|
String |
getContentType()
Get the content type of the message if set.
|
String |
getDestinationURI()
Get the current destination URI for this message.
|
Map<String,List<String>> |
getDuplicateStringTransportHeaders()
Get the map of current transport header duplicate values
|
Map<String,List<Object>> |
getDuplicateTransportHeaders()
Get the map of current transport header duplicate values
|
<H> Map<String,List<H>> |
getDuplicateTransportHeaders(Class<H> type)
Get the map of current transport header duplicate values
|
Optional<String> |
getFirstStringTransportHeader(String key) |
Optional<String> |
getFirstStringTransportHeaderIgnoreCase(String key) |
<H> Optional<H> |
getFirstTransportHeader(String key,
Class<H> type)
Get the first transport header with the given key as as a typed object of type H
|
<H> Optional<H> |
getFirstTransportHeaderIgnoreCase(String key,
Class<H> type)
This will perform a case insensitive lookup for the first occurrence of the given transport header and retrieve
it as as a typed object of type H
|
UUID |
getMessageId() |
Map<String,Object> |
getMessageProperties()
Return current message properties as an unmodifiable map
|
<P> Optional<P> |
getMessageProperty(String key,
Class<P> cls)
Get the message property associated with the specified key as a typed object of type P
|
XMessageFormat |
getPayload()
Get the current payload of the message
|
String |
getRequestContentType()
Return the content type of the original request.
|
int |
getResponseCode()
Gets the response code of the message
|
Optional<String> |
getStringMessageProperty(String key)
Get the String message property associated with the specified key
|
Map<String,String> |
getStringTransportHeaders()
Get the map of current transport header values ignoring duplicates
|
List<String> |
getStringTransportHeaders(String key)
Get a List of transport header values for the given key
|
Map<String,Object> |
getTransportHeaders()
Get the map of current transport header values ignoring duplicates
|
<H> Map<String,H> |
getTransportHeaders(Class<H> type)
Get the map of current transport header values ignoring duplicates
|
List<Object> |
getTransportHeaders(String key)
Get a List of transport header values for the given key
|
<H> List<H> |
getTransportHeaders(String key,
Class<H> type)
Get a List of transport header values for the given key
|
boolean |
hasAttachment(String key)
Checks if there is an attachment by the given key
|
boolean |
hasAttachments()
Checks whether this xMessageContext contains attachments
|
boolean |
hasMessageProperty(String key)
Checks whether the given property is present in the message properties map
|
boolean |
hasTransportHeader(String key)
Checks whether the give header is present in the message headers
|
void |
removeAllTransportHeaders()
Remove all transport headers
|
void |
removeAttachment(String key)
Removes
XAttachment with the given key |
void |
removeMessageProperty(String key)
Remove the message property associated with the specified key
|
void |
removeTransportHeader(String key)
Remove all occurrences of the specified transport header
|
void |
removeTransportHeaders(String... headers)
Remove transport headers specified in the comma separated list
|
<H> void |
replaceTransportHeader(String key,
H value)
Replace the first occurrence of the transport header with the given value
|
void |
retainOnlyTransportHeaders(String... headers)
Retain only transport headers specified in the comma separated list
|
void |
setAttachment(String key,
XAttachment value)
Sets a new attachment by adding it to the map of attachments
|
void |
setContentType(String contentType)
Set the content type of the message
|
void |
setDestinationURI(String destinationURI)
Set the destination URI for this message
|
void |
setPayload(XMessageFormat currentPayload) |
void |
setResponseCode(int responseCode)
Sets the response code of the message
|
XMessageFormat getPayload()
int getResponseCode()
void setResponseCode(int responseCode)
responseCode
- the integer
response code to be setUUID getMessageId()
XMessage cloneFullMessage()
XMessage
XMessage cloneMessageWithoutPayload()
XMessage
void setPayload(XMessageFormat currentPayload)
boolean hasTransportHeader(String key)
key
- the key to be checked for existence<H> Optional<H> getFirstTransportHeader(String key, Class<H> type)
H
- the type of the headerkey
- the header nametype
- the class of the header typeIllegalArgumentException
- if the header value cannot be converted to the given type<H> Optional<H> getFirstTransportHeaderIgnoreCase(String key, Class<H> type)
H
- the type of the headerkey
- the case insensitive header nametype
- the class of the header typeIllegalArgumentException
- if the header value cannot be converted to the given typeOptional<String> getFirstStringTransportHeaderIgnoreCase(String key)
<H> void addTransportHeader(String key, H value)
H
- the type of the header valuekey
- name of the header to be addedvalue
- header value to be setvoid removeTransportHeader(String key)
key
- header name to removevoid removeAllTransportHeaders()
void removeTransportHeaders(String... headers)
headers
- a list of transport headers to removevoid retainOnlyTransportHeaders(String... headers)
headers
- a list of transport headers to retain<H> void replaceTransportHeader(String key, H value)
H
- the type of the new header valuekey
- the name of the header to be replacedvalue
- the new value to be set<H> List<H> getTransportHeaders(String key, Class<H> type)
H
- the type of the header valuekey
- the name of the transport header to be retrievedtype
- the class of the type of the expected header value list<H> Map<String,H> getTransportHeaders(Class<H> type)
H
- the type of the header values to be returnedtype
- the class of the type of the header values<H> Map<String,List<H>> getDuplicateTransportHeaders(Class<H> type)
H
- the type of the header values to be returnedtype
- the class of the type of the headers to be retrievedList<Object> getTransportHeaders(String key)
key
- the name of the transport header to retrieve the header valuesMap<String,Object> getTransportHeaders()
Map<String,List<Object>> getDuplicateTransportHeaders()
List<String> getStringTransportHeaders(String key)
key
- the name of the transport header to retrieve the String
header valuesMap<String,String> getStringTransportHeaders()
Map<String,List<String>> getDuplicateStringTransportHeaders()
<P> void addMessageProperty(String key, P value)
P
- the type of the value of the property to be addedkey
- property keyvalue
- property value<P> Optional<P> getMessageProperty(String key, Class<P> cls)
P
- the type of the propertykey
- the property keycls
- the class of the property typeIllegalArgumentException
- if the message property cannot be converted to the given typeOptional<String> getStringMessageProperty(String key)
key
- property keyvoid removeMessageProperty(String key)
key
- property keyboolean hasMessageProperty(String key)
key
- the key to be checked for existenceMap<String,Object> getMessageProperties()
String getDestinationURI()
void setDestinationURI(String destinationURI)
destinationURI
- the new destination URIString getContentType()
String getRequestContentType()
void setContentType(String contentType)
contentType
- the content type string to be setMap<String,XAttachment> getAttachments()
void setAttachment(String key, XAttachment value)
key
- String
key for an attachmentvalue
- XAttachment
an attachmentvoid removeAttachment(String key)
XAttachment
with the given keykey
- String
key of the attachment to be removedOptional<XAttachment> getAttachment(String key)
key
- String
keyOptional
containing the XAttachment
if exists and Optional.EMPTY
otherwiseboolean hasAttachments()
boolean hasAttachment(String key)
key
- String
keyvoid addPayloadToRelease(XMessageFormat payload)
XMessageFormat
(i.e : payload ) with XMessage
in order to GC with
XMessage
resulting any XMessageFormat
s obtained from File Store to release with it.payload
- XMessageFormat
instance to be releasedCopyright © 2016–2019 AdroitLogic. All rights reserved.