Package com.attivio.sdk.esb
Class AbstractPlatformMessage
- java.lang.Object
-
- com.attivio.sdk.esb.AbstractPlatformMessage
-
- All Implemented Interfaces:
PlatformMessage,java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
AbstractIndexMessage,AdminMessage,AuthenticationRequest,AuthenticationResponse,CgiRequest,ExceptionResponse,ProcessingResultMessage,PropertiesMessage,QueryRequest,QueryResponse,StreamResponse,StringMessage
public abstract class AbstractPlatformMessage extends java.lang.Object implements PlatformMessage
Base class that handles many of the implementation-level details of an PlatformMessage.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.attivio.sdk.esb.PlatformMessage
DEFAULT_MAX_LOG_LENGTH, MESSAGE_DROPPED, MESSAGE_SEND_TIME_PROP, PROP_MAX_LOG_LENGTH
-
-
Constructor Summary
Constructors Constructor Description AbstractPlatformMessage()Creates a message with no client IDAbstractPlatformMessage(java.util.UUID cid)Creates a message based on a client ID.AbstractPlatformMessage(java.util.UUID cid, WorkflowQueue workflows)Creates a message based on a client ID and a workflow queue.AbstractPlatformMessage(java.util.UUID cid, java.lang.String... workflows)Creates a message based on a client ID.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessageHistory(MessageHistory msg)Adds a piece of message history.voidaddMessageHistory(java.util.List<MessageHistory> historyList)Adds a list of history.AbstractPlatformMessageclone()Clones the object and resets message ID to -1.booleanequals(java.lang.Object other)java.util.UUIDgetClientId()Gets the client to which this message belongs (may have originated with the client or be a response to the client).longgetEstimatedSize()java.util.List<MessageHistory>getMessageHistory()Gets this message's history.MessageIdgetMessageId()Gets the message id associated with the message.MessageMetadatagetMetadata()Gets the message metadata from this message.java.lang.ObjectgetProperty(java.lang.String key)Gets an arbitrary property for the message.booleangetProperty(java.lang.String key, boolean defaultValue)Gets a boolean property with a default value if not set.intgetProperty(java.lang.String key, int defaultValue)Gets an int property with a default value if not set.longgetProperty(java.lang.String key, long defaultValue)Gets a long property with a default value if not set.java.lang.ObjectgetProperty(java.lang.String key, java.lang.Object defaultValue)Gets an object property with a default value if not set.java.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)Gets a string property with a default value if not set.WorkflowQueuegetWorkflowQueue()Gets the workflow queue.WorkflowQueuegetWorkflowQueue(boolean createIfNull)Optionally creates a new empty queue if null.inthashCode()booleanhasProperty(java.lang.String key)Used to determine if a message has a property namedkeyset or not.booleanisRedelivered()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.voidremoveProperty(java.lang.String key)Removes a property from the message.WorkflowQueueremoveWorkflowQueue()Remove the workflow queue for this message.voidsetClientId(java.util.UUID clientId)Sets the client to which this message belongs.voidsetMessageId(MessageId msgId)Sets the message id associated with the message.voidsetProperty(java.lang.String key, java.lang.Object value)Sets an arbitrary property for the message.voidsetRedelivered(boolean redelivered)Sets the re-delivered flag.voidsetWorkflowQueue(WorkflowQueue workflowQueue)Sets the workflow queue.voidsetWorkflowQueue(java.lang.String... workflows)Sets the workflow queue.java.lang.StringtoMessageString()Gets a string-based representation of the message containing string data only.java.lang.StringtoString()protected java.lang.StringBuildertoString(java.lang.StringBuilder buffer)Append the string form of this request tobuffer.protected static voidtoString(java.lang.StringBuilder buffer, java.lang.String label, boolean value, boolean defaultValue)Helper method for constructing toString for PlatformMessages.protected static voidtoString(java.lang.StringBuilder buffer, java.lang.String label, int value)Helper method for constructing toString for PlatformMessages.protected static voidtoString(java.lang.StringBuilder buffer, java.lang.String label, int value, int defaultValue)Helper method for constructing toString for PlatformMessages.protected static voidtoString(java.lang.StringBuilder buffer, java.lang.String label, long value)Helper method for constructing toString for PlatformMessages.protected static voidtoString(java.lang.StringBuilder buffer, java.lang.String label, long value, long defaultValue)Helper method for constructing toString for PlatformMessages.protected static <V> voidtoString(java.lang.StringBuilder buffer, java.lang.String label, V value)Helper method for constructing toString for PlatformMessages.protected static <V> voidtoString(java.lang.StringBuilder buffer, java.lang.String label, V[] value)Helper method for constructing toString for PlatformMessages.protected static <V> voidtoString(java.lang.StringBuilder buffer, java.lang.String label, V value, V defaultValue)Helper method for constructing toString for PlatformMessages.
-
-
-
Constructor Detail
-
AbstractPlatformMessage
public AbstractPlatformMessage()
Creates a message with no client ID
-
AbstractPlatformMessage
public AbstractPlatformMessage(java.util.UUID cid)
Creates a message based on a client ID.- Parameters:
cid- the client ID
-
AbstractPlatformMessage
public AbstractPlatformMessage(java.util.UUID cid, java.lang.String... workflows)Creates a message based on a client ID.- Parameters:
cid- the client IDworkflows- the array of workflows
-
AbstractPlatformMessage
public AbstractPlatformMessage(java.util.UUID cid, WorkflowQueue workflows)Creates a message based on a client ID and a workflow queue.- Parameters:
cid- the client IDworkflows- the workflow queue
-
-
Method Detail
-
removeProperty
public void removeProperty(java.lang.String key)
Removes a property from the message.- Specified by:
removePropertyin interfacePlatformMessage
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
Gets an arbitrary property for the message. Some transformations of messages may result in the value being converted to a String.- Specified by:
getPropertyin interfacePlatformMessage- Parameters:
key- the key- Returns:
- property value
-
getProperty
public java.lang.Object getProperty(java.lang.String key, java.lang.Object defaultValue)Gets an object property with a default value if not set.- Parameters:
key-defaultValue-- Returns:
- the property value or
defaultValueif not set.
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)Gets a string property with a default value if not set.- Parameters:
key-defaultValue-- Returns:
- the property value or
defaultValueif not set.
-
getProperty
public int getProperty(java.lang.String key, int defaultValue)Gets an int property with a default value if not set.- Parameters:
key-defaultValue-- Returns:
- the property value or
defaultValueif not set.
-
getProperty
public long getProperty(java.lang.String key, long defaultValue)Gets a long property with a default value if not set.- Parameters:
key-defaultValue-- Returns:
- the property value or
defaultValueif not set.
-
getProperty
public boolean getProperty(java.lang.String key, boolean defaultValue)Gets a boolean property with a default value if not set.- Parameters:
key-defaultValue-- Returns:
- the property value or
defaultValueif not set.
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)Sets an arbitrary property for the message. Some transformations of messages may result in the value being converted to a String.- Specified by:
setPropertyin interfacePlatformMessage- Parameters:
key- the keyvalue- the value
-
hasProperty
public boolean hasProperty(java.lang.String key)
Used to determine if a message has a property namedkeyset or not.- Parameters:
key-- Returns:
- true if the message has the property
key
-
getClientId
public java.util.UUID getClientId()
Gets the client to which this message belongs (may have originated with the client or be a response to the client).- Specified by:
getClientIdin interfacePlatformMessage- Returns:
- the client ID
-
setClientId
public void setClientId(java.util.UUID clientId)
Sets the client to which this message belongs.- Specified by:
setClientIdin interfacePlatformMessage- Parameters:
clientId- the client ID
-
getMessageId
public MessageId getMessageId()
Gets the message id associated with the message. message ids are used for internal ordering guarantees and may change as the message propagates through the system.- Specified by:
getMessageIdin interfacePlatformMessage- Returns:
- the message ID
-
setMessageId
public void setMessageId(MessageId msgId)
Sets the message id associated with the message.- Specified by:
setMessageIdin interfacePlatformMessage- Parameters:
msgId- the message ID
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toMessageString
public java.lang.String toMessageString()
Gets a string-based representation of the message containing string data only.- Specified by:
toMessageStringin interfacePlatformMessage- Returns:
- the message string
-
toString
protected java.lang.StringBuilder toString(java.lang.StringBuilder buffer)
Append the string form of this request tobuffer.
-
getMetadata
public MessageMetadata getMetadata()
Gets the message metadata from this message.- Specified by:
getMetadatain interfacePlatformMessage- Returns:
- the message metadata
-
getMessageHistory
public java.util.List<MessageHistory> getMessageHistory()
Gets this message's history.- Specified by:
getMessageHistoryin interfacePlatformMessage- Returns:
- the message history
-
addMessageHistory
public void addMessageHistory(MessageHistory msg)
Adds a piece of message history.- Specified by:
addMessageHistoryin interfacePlatformMessage- Parameters:
msg- the message to add
-
addMessageHistory
public void addMessageHistory(java.util.List<MessageHistory> historyList)
Adds a list of history.- Specified by:
addMessageHistoryin interfacePlatformMessage- Parameters:
historyList-
-
getWorkflowQueue
public WorkflowQueue getWorkflowQueue()
Gets the workflow queue. Modifying the returned value will change the workflow destinations for the message.- Specified by:
getWorkflowQueuein interfacePlatformMessage- Returns:
- the workflow queue, may be null.
-
getWorkflowQueue
public WorkflowQueue getWorkflowQueue(boolean createIfNull)
Optionally creates a new empty queue if null. Modifying the returned value will change the workflow destinations for the message.- Specified by:
getWorkflowQueuein interfacePlatformMessage- Parameters:
createIfNull- if true and the queue is not set, creates a new empty queue- Returns:
- the workflow queue
-
removeWorkflowQueue
public WorkflowQueue removeWorkflowQueue()
Remove the workflow queue for this message.- Returns:
- the WorkflowQueue that was previously set on this message.
-
setWorkflowQueue
public void setWorkflowQueue(WorkflowQueue workflowQueue)
Sets the workflow queue.wfQueuewill be cloned.- Specified by:
setWorkflowQueuein interfacePlatformMessage- Parameters:
workflowQueue- the workflow queue
-
setWorkflowQueue
public void setWorkflowQueue(java.lang.String... workflows)
Sets the workflow queue.wfQueuewill be cloned.- Specified by:
setWorkflowQueuein interfacePlatformMessage- Parameters:
workflows- the list of workflows
-
isRedelivered
public 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.- Specified by:
isRedeliveredin interfacePlatformMessage- Returns:
- true if the message is re-delivered
-
setRedelivered
public void setRedelivered(boolean redelivered)
Sets the re-delivered flag.- Specified by:
setRedeliveredin interfacePlatformMessage
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
clone
public AbstractPlatformMessage clone()
Clones the object and resets message ID to -1. Clones a message. The message ID is not cloned.- Specified by:
clonein interfacePlatformMessage- Overrides:
clonein classjava.lang.Object- Returns:
- the cloned index message
-
toString
protected static final void toString(java.lang.StringBuilder buffer, java.lang.String label, boolean value, boolean defaultValue)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final void toString(java.lang.StringBuilder buffer, java.lang.String label, int value)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final void toString(java.lang.StringBuilder buffer, java.lang.String label, int value, int defaultValue)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final void toString(java.lang.StringBuilder buffer, java.lang.String label, long value)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final void toString(java.lang.StringBuilder buffer, java.lang.String label, long value, long defaultValue)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final <V> void toString(java.lang.StringBuilder buffer, java.lang.String label, V value)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final <V> void toString(java.lang.StringBuilder buffer, java.lang.String label, V value, V defaultValue)Helper method for constructing toString for PlatformMessages.
-
toString
protected static final <V> void toString(java.lang.StringBuilder buffer, java.lang.String label, V[] value)Helper method for constructing toString for PlatformMessages.
-
getEstimatedSize
public long getEstimatedSize()
- Specified by:
getEstimatedSizein interfacePlatformMessage
-
-