public interface Message extends Serializable
A Message
is what an application sends or receives when interacting with the Messaging System.
The Message
interface is modeled to be as generic (i.e. protocol independent) as possible from the
application's point of view. It contains only the most common information that is important to the sender and
receiver of a message.
The Message
interface was defined with the following goals in mind:
Message
is composed of header fields and payload. The header fields have accessor methods directly in
the Message interface. This approach is used to be consistent with JMS specification.
Header fields include:
MessagingSystem
and is read-only to applications)
Not all of the message header fields are expected to be supported by all Messages
, due to the
inherent differences in protocols. When the implementation of the Message interface for a particular protocol does
not support a header field (e.g. a correlation ID), it can throw an InvalidParamException
or ignore
the parameter on set methods and return null
on get methods.
Each Message
must have one XML payload set as document. In addition to that, it might have any number
of attachments of type XML, text or binary. The Message
interface defines several methods for
applications to deal with payloads:
Once a payload is added to the Message
, it can not be removed again. To do that, a new
Message
has to be created and populated with the new payloads.
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(Payload attachment)
Adds an attachment to the message.
|
int |
countAttachments()
Returns the number of attachments in this message.
|
ErrorInfo |
createErrorInfo()
Creates a new protocol implementation specific version of the ErrorInfo container interface and returns it.
|
Payload |
createPayload()
Creates an empty binary payload.
|
TextPayload |
createTextPayload()
Creates an empty text payload.
|
XMLPayload |
createXMLPayload()
Creates an empty XML payload.
|
Action |
getAction()
Returns the
Action in the service that shall process this message. |
Payload |
getAttachment(String name)
Returns an attachment by name if the XML message protocol used for this message supports attachment names.
|
Iterator |
getAttachmentIterator()
Returns an iterator to iterate over the attachments.
|
String |
getCorrelationId()
Returns the correlation ID that identifies a sequence messages, which semantically belong together.
|
DeliverySemantics |
getDeliverySemantics()
Returns the delivery semantics (QoS) of the message.
|
String |
getDescription()
Returns a descriptive text for the message.
|
XMLPayload |
getDocument()
Returns the main document as XMLPayload.
|
ErrorInfo |
getErrorInfo()
Returns the ErrorInfo container of the current message, if available.
|
Party |
getFromParty()
Returns the
Party object that represents the sender. |
Service |
getFromService()
Returns the
Service object that represents the service that originally sent this message. |
Payload |
getMainPayload()
Returns the main payload.
|
MessageClass |
getMessageClass()
Returns the message class of this message.
|
MessageDirection |
getMessageDirection()
Returns the direction of the message.
|
String |
getMessageId()
Returns the unique message ID.
|
MessageKey |
getMessageKey()
Returns the MessageKey.
|
String |
getMessageProperty(MessagePropertyKey key)
Returns the value of an additional message property, in case that such an value exists.
|
String |
getMessageProperty(String namespace,
String name)
Deprecated.
Use getMessageProperty(MessagePropertyKey), instead.
|
Set<MessagePropertyKey> |
getMessagePropertyKeys()
Returns all keys of existing additional message property, which can be used to retrieve the corresponding values.
|
String |
getProtocol()
Returns the protocol of this message (i.e. message format)
|
String |
getRefToMessageId()
Returns the ID of the message that this message refers to (or is in response to).
|
String |
getSequenceId()
Returns the ID that identifies the sequence of an EOIO message exchange.
|
String |
getSerializationContext()
This method returns the message protocol specific serialization context value, for this message.
|
long |
getTimeReceived()
Returns the time when the message was received.
|
long |
getTimeSent()
Returns the time when the message was sent.
|
Party |
getToParty()
Returns the
Party object that represents the receiver. |
Service |
getToService()
Returns the
Service object that represents the service that will ultimately process this message. |
boolean |
isAck()
Returns if the current message is an acknowledgement message.
|
boolean |
isAck(AckType ackType)
Returns if the current message is an acknowledgement message of the specified type.
|
boolean |
isAckRequested()
Returns if for the current message an acknowledgement message is requested.
|
boolean |
isAckRequested(AckType ackType)
Returns if for the current message an acknowledgement message of the specified type is requested.
|
void |
removeAttachment(String name)
Removes an attachment by name if the XML message protocol used for this message supports attachment names.
|
void |
removeMessageProperty(MessagePropertyKey key)
Removes the entry of an additional message property, in case that such an entry exists.
|
void |
setCorrelationId(String id)
Sets the correlation ID that identifies a sequence of message, which sematically belong together.
|
void |
setDeliverySemantics(DeliverySemantics ds)
Sets the delivery semantics (QoS) of the outgoing message.
|
void |
setDescription(String description)
Sets the description of the message
|
void |
setDocument(XMLPayload document)
Sets the main document.
|
void |
setErrorInfo(ErrorInfo errorInfo)
Sets the ErrorInfo container for the current message, that was created with createErrorInfo method before.
|
void |
setMainPayload(Payload payload)
Sets the main payload.
|
void |
setMessageProperty(MessagePropertyKey key,
String value)
Sets an additional message field, if supported by the Message protocol implementation.
|
void |
setMessageProperty(String namespace,
String name,
String value)
Deprecated.
Use setMessageProperty(MessagePropertyKey, String), instead.
|
void |
setRefToMessageId(String id)
Sets the ID that indicates which message this message refers to.
|
void |
setSequenceId(String id)
Sets the ID that identifies the sequence of an EOIO message exchange.
|
String getSerializationContext()
void addAttachment(Payload attachment) throws PayloadFormatException
attachment
- the payload that will be added to the message as an attachment.PayloadFormatException
- if the payload is invalid.int countAttachments()
Payload createPayload()
TextPayload createTextPayload()
XMLPayload createXMLPayload()
Action getAction()
Action
in the service that shall process this message.Payload getAttachment(String name)
name
- the name of a particular attachment.null
.void removeAttachment(String name)
name
- the name of a particular attachment to be removed.Iterator getAttachmentIterator()
String getSequenceId()
null
if this message is not part of a sequence.String getCorrelationId()
null
if this message is not part of a correlation.DeliverySemantics getDeliverySemantics()
String getDescription()
XMLPayload getDocument()
Payload getMainPayload()
Party getFromParty()
Party
object that represents the sender.Service getFromService()
Service
object that represents the service that originally sent this message.MessageDirection getMessageDirection()
String getMessageId()
MessagingSystem
in order to guarantee that it is a) unique and b) in the format required by the
underlying messaging protocol.MessageKey getMessageKey()
String getProtocol()
String getRefToMessageId()
null
if this message does not refer to a
previous message.Party getToParty()
Party
object that represents the receiver.Service getToService()
Service
object that represents the service that will ultimately process this message.long getTimeReceived()
long getTimeSent()
void setDescription(String description) throws InvalidParamException
description
- text to describe the messageInvalidParamException
- if the description text is invalid.void setRefToMessageId(String id) throws InvalidParamException
getMessageId
on the request
message.id
- the ID of the message that this message refers to.InvalidParamException
- if the ID is invalid.void setSequenceId(String id) throws InvalidParamException
id
- the sequence IDInvalidParamException
- if the ID is invalidvoid setCorrelationId(String id) throws InvalidParamException
id
- the correlation IDInvalidParamException
- if the ID is invalidvoid setDeliverySemantics(DeliverySemantics ds) throws InvalidParamException
ds
- is the delivery semantics (i.e. BestEffort, ExactlyOnce, or ExactlyOnceInOrder)InvalidParamException
- is thrown when the value is invalid or not support by the protocol.void setDocument(XMLPayload document) throws PayloadFormatException
document
- the document.PayloadFormatException
- if the payload is invalid.void setMainPayload(Payload payload) throws PayloadFormatException
payload
- the main payload.PayloadFormatException
- if the payload is invalid.MessageClass getMessageClass()
void setMessageProperty(String namespace, String name, String value) throws InvalidParamException
value
- string valuename
- string namenamespace
- string namespaceInvalidParamException
- InvalidParamExceptionString getMessageProperty(String namespace, String name)
name
- string namenamespace
- string namespacevoid setMessageProperty(MessagePropertyKey key, String value) throws InvalidParamException
key
- The key (consisting of name and namespace) of the property to set.value
- The value of the property to set. When null is given as the value param, an already set value will be
deleted.InvalidParamException
- If either the length of one of the parameters is too long, or in case of an
unknown/not allowed namespace/name combination (but only if the Message implementation has the necessary
knowledge about the valid namespace/name pairs).String getMessageProperty(MessagePropertyKey key)
key
- The key (consisting of name and namespace) of the property to set.void removeMessageProperty(MessagePropertyKey key)
key
- The key (consisting of name and namespace) of the property to be removed.Set<MessagePropertyKey> getMessagePropertyKeys()
boolean isAck()
boolean isAck(AckType ackType)
ackType
- The acknowledgement type to be checked.boolean isAckRequested()
boolean isAckRequested(AckType ackType)
ackType
- The acknowledgement type to be checked.ErrorInfo createErrorInfo()
void setErrorInfo(ErrorInfo errorInfo) throws InvalidParamException
errorInfo
- The ErrorInfo container to be set for the current message.InvalidParamException
- InvalidParamExceptionErrorInfo getErrorInfo()
Access Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] SAP_XIAF
|
[sap.com] com.sap.aii.af.ifc.facade
|
api
|
BC-XI
|
Copyright 2019 SAP AG Complete Copyright Notice