Interface Message
- All Known Subinterfaces:
BinaryMessage,ContainerMessage,GenericMessage,JsonChannelMessage,JsonMessage,ListMessage,MappingMessage,NewsMessage,PageMessage,PermissionMessage,RecordMessage,RecordType1Message,RecordType2Message,RecordType3Message,StoryMessage,WrapperMessage
Message represents a DataSource message containing an update to an existing subject or a complete
image of it.
Message is the base interface for all messages generated by DataSource regardless of the message
type. Therefore the base interface provides no functionality for altering the content of the message and one of the
following derived interfaces should be used to add data to a Message:
RecordType1MessageRecordType2MessageRecordType3MessageGenericMessageContainerMessagePermissionMessageNewsMessageStoryMessagePageMessage
You do not have to implement this interface yourself. Implementations of Message can be created by
calling the relevant creation method on MessageFactory; for example,
MessageFactory.createRecordType1Message(String) or
MessageFactory.createContainerMessage(String).
Note: After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.
-
Method Summary
Modifier and TypeMethodDescriptionGets the type for this message.Gets the subject of this message.booleanisImage()Gets a boolean value indicating whether thisMessagerepresents an image or an update.voidsetImage(boolean image) Sets a boolean value indicating whether thisMessagerepresents an image of the data or an update to it.
-
Method Details
-
isImage
boolean isImage()Gets a boolean value indicating whether thisMessagerepresents an image or an update. By default, this method returnsfalseindicating that theMessageis an update and not an image. To change a message to be an image, callsetImage(boolean)passing in the valuetrue.- Returns:
trueif this message is an image of the object,falseif it is an update to the existing state of the object.
-
setImage
void setImage(boolean image) Sets a boolean value indicating whether thisMessagerepresents an image of the data or an update to it. By default, a newly createdMessageis deemed to be an update and not an image.Clients using Binary or JSON messages should not call this method as any messages of these types are handled as images. For these, this method is used internally only.
- Parameters:
image- When set totrue, the receiver will clear all previous data for that subject before adding the sent data. When set tofalse, the receiver adds the sent data to previous data sent to that subject.
-
getSubject
String getSubject()Gets the subject of this message.- Returns:
- The subject.
-
getMessageType
MessageType getMessageType()Gets the type for this message.- Returns:
- The MessageType for this message
-