public abstract class AbstractPlatformMessage extends Object implements PlatformMessage
DEFAULT_MAX_LOG_LENGTH, MESSAGE_DROPPED, MESSAGE_SEND_TIME_PROP, PROP_MAX_LOG_LENGTH
Constructor and Description |
---|
AbstractPlatformMessage()
Creates a message with no client ID
|
AbstractPlatformMessage(UUID cid)
Creates a message based on a client ID.
|
AbstractPlatformMessage(UUID cid,
String... workflows)
Creates a message based on a client ID.
|
AbstractPlatformMessage(UUID cid,
WorkflowQueue workflows)
Creates a message based on a client ID and a workflow queue.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessageHistory(List<MessageHistory> historyList)
Adds a list of history.
|
void |
addMessageHistory(MessageHistory msg)
Adds a piece of message history.
|
AbstractPlatformMessage |
clone()
Clones the object and resets message ID to -1.
|
boolean |
equals(Object other) |
UUID |
getClientId()
Gets the client to which this message belongs (may have originated with the client or be a response to the client).
|
long |
getEstimatedSize() |
List<MessageHistory> |
getMessageHistory()
Gets this message's history.
|
MessageId |
getMessageId()
Gets the message id associated with the message.
|
MessageMetadata |
getMetadata()
Gets the message metadata from this message.
|
Object |
getProperty(String key)
Gets an arbitrary property for the message.
|
boolean |
getProperty(String key,
boolean defaultValue)
Gets a boolean property with a default value if not set.
|
int |
getProperty(String key,
int defaultValue)
Gets an int property with a default value if not set.
|
long |
getProperty(String key,
long defaultValue)
Gets a long property with a default value if not set.
|
Object |
getProperty(String key,
Object defaultValue)
Gets an object property with a default value if not set.
|
String |
getProperty(String key,
String defaultValue)
Gets a string property with a default value if not set.
|
WorkflowQueue |
getWorkflowQueue()
Gets the workflow queue.
|
WorkflowQueue |
getWorkflowQueue(boolean createIfNull)
Optionally creates a new empty queue if null.
|
int |
hashCode() |
boolean |
hasProperty(String key)
Used to determine if a message has a property named
key set or not. |
boolean |
isRedelivered()
Returns true if the message (or its originating message) is re-delivered Redelivery is generally due to a failure and
subsequent recovery in a fault tolerant system.
|
void |
removeProperty(String key)
Removes a property from the message.
|
WorkflowQueue |
removeWorkflowQueue()
Remove the workflow queue for this message.
|
void |
setClientId(UUID clientId)
Sets the client to which this message belongs.
|
void |
setMessageId(MessageId msgId)
Sets the message id associated with the message.
|
void |
setProperty(String key,
Object value)
Sets an arbitrary property for the message.
|
void |
setRedelivered(boolean redelivered)
Sets the re-delivered flag.
|
void |
setWorkflowQueue(String... workflows)
Sets the workflow queue.
|
void |
setWorkflowQueue(WorkflowQueue workflowQueue)
Sets the workflow queue.
|
String |
toMessageString()
Gets a string-based representation of the message containing string data only.
|
String |
toString() |
protected StringBuilder |
toString(StringBuilder buffer)
Append the string form of this request to
buffer . |
protected static void |
toString(StringBuilder buffer,
String label,
boolean value,
boolean defaultValue)
Helper method for constructing toString for PlatformMessages.
|
protected static void |
toString(StringBuilder buffer,
String label,
int value)
Helper method for constructing toString for PlatformMessages.
|
protected static void |
toString(StringBuilder buffer,
String label,
int value,
int defaultValue)
Helper method for constructing toString for PlatformMessages.
|
protected static void |
toString(StringBuilder buffer,
String label,
long value)
Helper method for constructing toString for PlatformMessages.
|
protected static void |
toString(StringBuilder buffer,
String label,
long value,
long defaultValue)
Helper method for constructing toString for PlatformMessages.
|
protected static <V> void |
toString(StringBuilder buffer,
String label,
V value)
Helper method for constructing toString for PlatformMessages.
|
protected static <V> void |
toString(StringBuilder buffer,
String label,
V[] value)
Helper method for constructing toString for PlatformMessages.
|
protected static <V> void |
toString(StringBuilder buffer,
String label,
V value,
V defaultValue)
Helper method for constructing toString for PlatformMessages.
|
public AbstractPlatformMessage()
public AbstractPlatformMessage(UUID cid)
cid
- the client IDpublic AbstractPlatformMessage(UUID cid, String... workflows)
cid
- the client IDworkflows
- the array of workflowspublic AbstractPlatformMessage(UUID cid, WorkflowQueue workflows)
cid
- the client IDworkflows
- the workflow queuepublic void removeProperty(String key)
removeProperty
in interface PlatformMessage
public Object getProperty(String key)
getProperty
in interface PlatformMessage
key
- the keypublic Object getProperty(String key, Object defaultValue)
key
- defaultValue
- defaultValue
if not set.public String getProperty(String key, String defaultValue)
key
- defaultValue
- defaultValue
if not set.public int getProperty(String key, int defaultValue)
key
- defaultValue
- defaultValue
if not set.public long getProperty(String key, long defaultValue)
key
- defaultValue
- defaultValue
if not set.public boolean getProperty(String key, boolean defaultValue)
key
- defaultValue
- defaultValue
if not set.public void setProperty(String key, Object value)
setProperty
in interface PlatformMessage
key
- the keyvalue
- the valuepublic boolean hasProperty(String key)
key
set or not.key
- key
public UUID getClientId()
getClientId
in interface PlatformMessage
public void setClientId(UUID clientId)
setClientId
in interface PlatformMessage
clientId
- the client IDpublic MessageId getMessageId()
getMessageId
in interface PlatformMessage
public void setMessageId(MessageId msgId)
setMessageId
in interface PlatformMessage
msgId
- the message IDpublic String toMessageString()
toMessageString
in interface PlatformMessage
protected StringBuilder toString(StringBuilder buffer)
buffer
.public MessageMetadata getMetadata()
getMetadata
in interface PlatformMessage
public List<MessageHistory> getMessageHistory()
getMessageHistory
in interface PlatformMessage
public void addMessageHistory(MessageHistory msg)
addMessageHistory
in interface PlatformMessage
msg
- the message to addpublic void addMessageHistory(List<MessageHistory> historyList)
addMessageHistory
in interface PlatformMessage
historyList
- public WorkflowQueue getWorkflowQueue()
getWorkflowQueue
in interface PlatformMessage
public WorkflowQueue getWorkflowQueue(boolean createIfNull)
getWorkflowQueue
in interface PlatformMessage
createIfNull
- if true and the queue is not set, creates a new empty queuepublic WorkflowQueue removeWorkflowQueue()
public void setWorkflowQueue(WorkflowQueue workflowQueue)
wfQueue
will be cloned.setWorkflowQueue
in interface PlatformMessage
workflowQueue
- the workflow queuepublic void setWorkflowQueue(String... workflows)
wfQueue
will be cloned.setWorkflowQueue
in interface PlatformMessage
workflows
- the list of workflowspublic boolean isRedelivered()
isRedelivered
in interface PlatformMessage
public void setRedelivered(boolean redelivered)
setRedelivered
in interface PlatformMessage
public AbstractPlatformMessage clone()
clone
in interface PlatformMessage
clone
in class Object
protected static final void toString(StringBuilder buffer, String label, boolean value, boolean defaultValue)
protected static final void toString(StringBuilder buffer, String label, int value)
protected static final void toString(StringBuilder buffer, String label, int value, int defaultValue)
protected static final void toString(StringBuilder buffer, String label, long value)
protected static final void toString(StringBuilder buffer, String label, long value, long defaultValue)
protected static final <V> void toString(StringBuilder buffer, String label, V value)
protected static final <V> void toString(StringBuilder buffer, String label, V value, V defaultValue)
protected static final <V> void toString(StringBuilder buffer, String label, V[] value)
public long getEstimatedSize()
getEstimatedSize
in interface PlatformMessage
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.