public class Message extends Object implements XMessage
| Constructor and Description |
|---|
Message(XMessageFormat payload) |
| 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 XMessageFormats 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.
|
void |
close() |
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 |
setRequestContentType(String requestContentType) |
void |
setResponseCode(int responseCode)
Sets the response code of the message
|
String |
toString() |
public Message(XMessageFormat payload)
public UUID getMessageId()
getMessageId in interface XMessagepublic XMessageFormat getPayload()
XMessagegetPayload in interface XMessagepublic void setPayload(XMessageFormat currentPayload)
setPayload in interface XMessagepublic boolean hasTransportHeader(String key)
XMessagehasTransportHeader in interface XMessagekey - the key to be checked for existencepublic <H> Optional<H> getFirstTransportHeader(String key, Class<H> type)
XMessagegetFirstTransportHeader in interface XMessageH - the type of the headerkey - the header nametype - the class of the header typepublic Optional<String> getFirstStringTransportHeader(String key)
getFirstStringTransportHeader in interface XMessagepublic <H> Optional<H> getFirstTransportHeaderIgnoreCase(String key, Class<H> type)
XMessagegetFirstTransportHeaderIgnoreCase in interface XMessageH - the type of the headerkey - the case insensitive header nametype - the class of the header typepublic Optional<String> getFirstStringTransportHeaderIgnoreCase(String key)
getFirstStringTransportHeaderIgnoreCase in interface XMessagepublic <H> void addTransportHeader(String key, H value)
XMessageaddTransportHeader in interface XMessageH - the type of the header valuekey - name of the header to be addedvalue - header value to be setpublic void removeTransportHeader(String key)
XMessageremoveTransportHeader in interface XMessagekey - header name to removepublic void removeAllTransportHeaders()
XMessageremoveAllTransportHeaders in interface XMessagepublic void removeTransportHeaders(String... headers)
XMessageremoveTransportHeaders in interface XMessageheaders - a list of transport headers to removepublic void retainOnlyTransportHeaders(String... headers)
XMessageretainOnlyTransportHeaders in interface XMessageheaders - a list of transport headers to retainpublic <H> void replaceTransportHeader(String key, H value)
XMessagereplaceTransportHeader in interface XMessageH - the type of the new header valuekey - the name of the header to be replacedvalue - the new value to be setpublic <H> List<H> getTransportHeaders(String key, Class<H> type)
XMessagegetTransportHeaders in interface XMessageH - 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 listpublic <H> Map<String,H> getTransportHeaders(Class<H> type)
XMessagegetTransportHeaders in interface XMessageH - the type of the header values to be returnedtype - the class of the type of the header valuespublic <H> Map<String,List<H>> getDuplicateTransportHeaders(Class<H> type)
XMessagegetDuplicateTransportHeaders in interface XMessageH - the type of the header values to be returnedtype - the class of the type of the headers to be retrievedpublic List<Object> getTransportHeaders(String key)
XMessagegetTransportHeaders in interface XMessagekey - the name of the transport header to retrieve the header valuespublic Map<String,Object> getTransportHeaders()
XMessagegetTransportHeaders in interface XMessagepublic Map<String,List<Object>> getDuplicateTransportHeaders()
XMessagegetDuplicateTransportHeaders in interface XMessagepublic List<String> getStringTransportHeaders(String key)
XMessagegetStringTransportHeaders in interface XMessagekey - the name of the transport header to retrieve the String header valuespublic Map<String,String> getStringTransportHeaders()
XMessagegetStringTransportHeaders in interface XMessagepublic Map<String,List<String>> getDuplicateStringTransportHeaders()
XMessagegetDuplicateStringTransportHeaders in interface XMessagepublic <P> void addMessageProperty(String key, P value)
XMessageaddMessageProperty in interface XMessageP - the type of the value of the property to be addedkey - property keyvalue - property valuepublic <P> Optional<P> getMessageProperty(String key, Class<P> cls)
XMessagegetMessageProperty in interface XMessageP - the type of the propertykey - the property keycls - the class of the property typepublic Optional<String> getStringMessageProperty(String key)
XMessagegetStringMessageProperty in interface XMessagekey - property keypublic void removeMessageProperty(String key)
XMessageremoveMessageProperty in interface XMessagekey - property keypublic boolean hasMessageProperty(String key)
XMessagehasMessageProperty in interface XMessagekey - the key to be checked for existencepublic Map<String,Object> getMessageProperties()
XMessagegetMessageProperties in interface XMessagepublic String getDestinationURI()
XMessagegetDestinationURI in interface XMessagepublic void setDestinationURI(String destinationURI)
XMessagesetDestinationURI in interface XMessagedestinationURI - the new destination URIpublic String getContentType()
XMessagegetContentType in interface XMessagepublic String getRequestContentType()
XMessagegetRequestContentType in interface XMessagepublic void setRequestContentType(String requestContentType)
public void setContentType(String contentType)
XMessagesetContentType in interface XMessagecontentType - the content type string to be setpublic int getResponseCode()
XMessagegetResponseCode in interface XMessagepublic void setResponseCode(int responseCode)
XMessagesetResponseCode in interface XMessageresponseCode - the integer response code to be setpublic XMessage cloneFullMessage()
XMessagecloneFullMessage in interface XMessageXMessagepublic XMessage cloneMessageWithoutPayload()
XMessagecloneMessageWithoutPayload in interface XMessageXMessagepublic Map<String,XAttachment> getAttachments()
XMessagegetAttachments in interface XMessagepublic void setAttachment(String key, XAttachment value)
XMessagesetAttachment in interface XMessagekey - String key for an attachmentvalue - XAttachment an attachmentpublic void removeAttachment(String key)
XMessageXAttachment with the given keyremoveAttachment in interface XMessagekey - String key of the attachment to be removedpublic Optional<XAttachment> getAttachment(String key)
XMessagegetAttachment in interface XMessagekey - String keyOptional containing the XAttachment if exists and Optional.EMPTY otherwisepublic boolean hasAttachments()
XMessagehasAttachments in interface XMessagepublic boolean hasAttachment(String key)
XMessagehasAttachment in interface XMessagekey - String keypublic void addPayloadToRelease(XMessageFormat payload)
XMessageXMessageFormat (i.e : payload ) with XMessage in order to GC with
XMessage resulting any XMessageFormats obtained from File Store to release with it.addPayloadToRelease in interface XMessagepayload - XMessageFormat instance to be releasedpublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2016–2019 AdroitLogic. All rights reserved.