com.crankuptheamps.client
Class Message

java.lang.Object
  extended by com.crankuptheamps.client.Message
Direct Known Subclasses:
FIXMessage, JSONMessage, XMLMessage

public abstract class Message
extends Object


Nested Class Summary
static class Message.AckType
           
static class Message.Command
           
static class Message.Options
          Represents the options for an AMPS command.
static class Message.Reason
           
static class Message.Status
           
 
Field Summary
protected  CharsetDecoder decoder
           
protected  CharsetEncoder encoder
           
protected static int MINIMUM_SERVER_VERSION
           
 
Constructor Summary
Message(CharsetEncoder encoder, CharsetDecoder decoder)
           
 
Method Summary
protected  void _copyTo(Message destination)
           
abstract  Message copy()
           
 int getAckType()
          Returns the type of acknowledgement for an acknowledgement message.
 int getBatchSize()
          Returns the batch size for this message.
 String getBookmark()
          Returns the AMPS bookmark for this message.
 BookmarkField getBookmarkRaw()
          Gets the raw value for the AMPS bookmark.
 long getBookmarkSeqNo()
          Returns the bookmark sequence number for this message.
 byte[] getBuffer()
          Gets the byte buffer used by the message.
 String getClientName()
          Gets the client name on this message.
 Field getClientNameRaw()
          Gets the client name on this message.
 int getCommand()
          Returns the command for this message, indicating the type of of message this is.
 String getCommandId()
          Gets the CommandId on this message.
 boolean getCommandId(CommandId v)
          Gets the CommandId on this message by copying it into the provided CommandId object.
 Field getCommandIdRaw()
          Gets the CommandId on this message.
 String getCorrelationId()
          Get the CorrelationId on this message.
 StringField getCorrelationIdRaw()
          Get the CorrelationId on this message.
 String getData()
          Returns the payload of the message.
 Field getDataRaw()
          Returns the payload of the message.
 int getExpiration()
          Returns the expiration set for this message.
 String getFilter()
           
 Field getFilterRaw()
          Returns the filter on this message.
 long getGroupSeqNo()
          Get the group sequence number.
 int getLength()
          Returns the length of the message.
 long getMatches()
          Returns the number of matches in the command this message acknowledges.
 long getMaxMessages()
          Deprecated. This header is no longer used by AMPS.
 String getMessageId()
          Deprecated. This header is no longer used by AMPS.
 Field getMessageIdRaw()
          Deprecated. This header is no longer used by AMPS.
 String getOptions()
          Returns the options set on this message.
 String getOrderBy()
          Get the OrderBy parameter for this message.
 Field getOrderByRaw()
          Get the OrderBy parameter for this message.
 String getPassword()
          Returns the password set on the message.
 Field getPasswordRaw()
          Returns the password set on the message.
 String getQueryId()
          Returns the QueryId for this message.
 boolean getQueryId(CommandId v)
          Returns the QueryId for this message by copying it into the provided CommandId.
 Field getQueryIdRaw()
          Returns the QueryId for this message.
 int getRawBufferLength()
          Gets the length of the message within the byte buffer.
 int getRawBufferOffset()
          Gets the offset into the byte buffer where this message begins.
 int getReason()
          Returns the reason value of this message.
 String getReasonText()
          Returns the reason value of this message.
 long getRecordsDeleted()
          Returns the number of records deleted for the command that this message was produced in response to.
 long getRecordsInserted()
          Returns the number of records inserted for the command that this message was produced in response to.
 long getRecordsReturned()
          Returns the number of records returned for the command that this message was produced in response to.
 long getRecordsUpdated()
          Returns the number of records updated for the command that this message was produced in response to.
 boolean getSendEmpties()
          Gets the value of the send empties header.
 boolean getSendMatchingIds()
          Gets the value of the send keys header.
 boolean getSendOOF()
          Gets the value of the send OOF header.
 long getSequence()
          Returns the sequence number for this message.
 Field getSequenceRaw()
          Returns the sequence number for this message.
 String getSowKey()
          Returns the SowKey for this message.
 Field getSowKeyRaw()
          Returns the SowKey for this message.
 String getSowKeys()
          Gets the set of SowKeys this message applies to.
 Field getSowKeysRaw()
          Gets the set of SowKeys this message applies to.
 int getStatus()
          Returns the status of this message.
 String getSubId()
          Gets the SubId of this message.
 boolean getSubId(CommandId v)
          Gets the SubId of this message by copying it into the provided CommandId.
 Field getSubIdRaw()
          Gets the SubId of this message.
 String getSubIds()
          The set of SubIds for this message.
 Field getSubIdsRaw()
          The set of SubIds for this message.
 Subscription getSubscription()
          Gets the subscription for this message.
 String getTimestamp()
          Returns the timestamp for this message, an ISO-8601 formatted string.
 Field getTimestampRaw()
          Returns the timestamp for this message, an ISO-8601 formatted string.
 String getTopic()
          Return the topic that the message applies to.
 long getTopicMatches()
          Returns the number of matching topics for the command that this message was produced in response to.
 Field getTopicRaw()
          Return the topic that the message applies to.
 long getTopN()
          Get the TopN parameter for this message.
 String getUserId()
          Get the UserId for this message.
 Field getUserIdRaw()
          Get the UserId for this message.
 String getVersion()
          Returns the version of the AMPS server, provided in response to a logon.
 int getVersionAsInt()
          Returns the version of the AMPS server, provided in response to a logon.
 Field getVersionRaw()
          Returns the version of the AMPS server, provided in response to a logon.
 void reset()
           
 void setAckType(int v)
          Sets the type of acknowledgement for an acknowledgement message.
 void setAckType(String v)
          Sets the type of acknowledgement for an acknowlegdement message.
 void setBatchSize(int v)
          Sets the batch size for this message.
 void setBookmark(byte[] buffer, int offset, int length)
          Sets the value for the AMPS bookmark.
 void setBookmark(String v)
          Sets the value for the AMPS bookmark.
 void setBookmarkSeqNo(long val)
          Sets the bookmark sequence number for this message.
 void setBuffer(byte[] buffer)
          Sets the byte buffer used by the message.
 void setClientName(byte[] buffer, int offset, int length)
          Sets the name of the client sending the message.
 void setClientName(String v)
          Sets the name of the client sending the message.
 void setCommand(int v)
          Sets the command for this message, indicating the type of of message this is.
 void setCommand(String v)
          Sets the command for this message, indicating the type of of message this is.
 void setCommandId(byte[] buffer, int offset, int length)
          Sets the CommandId on this message.
 void setCommandId(CommandId v)
          Sets the CommandId on this message.
 void setCommandId(String v)
          Sets the CommandId on this message.
 void setCorrelationId(String v)
          Set the CorrelationId on this message.
 void setData(byte[] buffer, int offset, int length)
          Sets the payload of the message.
 void setData(String v)
          Sets the payload of the message.
 void setExpiration(int v)
          Sets the expiration set for this message.
 void setFilter(byte[] buffer, int offset, int length)
          Sets the filter on this message.
 void setFilter(String v)
          Sets the filter on this message.
 void setGroupSeqNo(long v)
          Set the group sequence number.
 void setLength(int v)
          Sets the length of the message.
 void setMatches(long v)
          Sets the matches field on this message.
 void setMaxMessages(long v)
          Deprecated. This header is no longer used by AMPS.
 void setMessageId(byte[] buffer, int offset, int position)
          Deprecated. This header is no longer used by AMPS.
 void setMessageId(String v)
          Deprecated. This header is no longer used by AMPS.
 void setOptions(String v)
          Sets the options for this message.
 void setOrderBy(byte[] buffer, int offset, int length)
          Set the OrderBy parameter for this message.
 void setOrderBy(String v)
          Set the OrderBy parameter for this message.
 void setPassword(byte[] buffer, int offset, int length)
          Set the password on the message.
 void setPassword(String v)
          Set the password on the message.
 void setQueryId(byte[] buffer, int offset, int position)
          Sets the QueryId for this message.
 void setQueryId(CommandId v)
          Sets the QueryId for this message.
 void setQueryId(String v)
          Sets the QueryId for this message.
 void setRawBufferLength(int length)
          Sets the length of the message within the byte buffer.
 void setRawBufferOffset(int offset)
          Sets the offset into the byte buffer where this message begins.
 void setReason(int v)
          Sets the reason value of this message.
 void setRecordsDeleted(long v)
          Sets the records deleted header field.
 void setRecordsInserted(long v)
          Returns the number of records inserted for the command that this message was produced in response to.
 void setRecordsReturned(long v)
          Sets the records returned header field.
 void setRecordsUpdated(long v)
          Sets the records updated header field.
 void setSendEmpties(boolean v)
          Sets the value of the send empties header.
 void setSendMatchingIds(boolean v)
          Gets the value of the send keys header.
 void setSendOOF(boolean v)
          Sets the value of the send OOF header.
 void setSequence(long v)
          Returns the sequence number for this message.
 void setSowKey(byte[] buffer, int offset, int length)
          Sets the SowKey for this message.
 void setSowKey(String v)
          Sets the SowKey for this message.
 void setSowKeys(byte[] buffer, int offset, int length)
          Sets the set of SowKeys this message applies to, as a comma-delimited list of identifiers.
 void setSowKeys(String v)
          Sets the set of SowKeys this message applies to, as a comma-delimited list of identifiers.
 void setStatus(int v)
          Sets the status of this message.
 void setSubId(byte[] buffer, int offset, int length)
          Sets the SubId of this message.
 void setSubId(CommandId v)
          Sets the SubId of this message.
 void setSubId(String v)
          Sets the SubId of this message.
 void setSubIds(byte[] buffer, int offset, int length)
          The set of SubIds for this message.
 void setSubIds(String v)
          The set of SubIds for this message.
 void setSubscription(Subscription subscription)
          Sets the subscription for this message.
 void setTimestamp(byte[] buffer, int offset, int length)
          Sets the timestamp for this message.
 void setTimestamp(String v)
          Sets the timestamp for this message.
 void setTopic(byte[] buffer, int offset, int length)
          Set the topic that the message applies to.
 void setTopic(String v)
          Set the topic that the message applies to.
 void setTopicMatches(long v)
          Sets the topic matches field on this message.
 void setTopN(long v)
          Set the TopN parameter for this message.
 void setUserId(byte[] buffer, int offset, int length)
          Set the UserId for this message.
 void setUserId(String v)
          Set the UserId for this message.
 void setVersion(byte[] buffer, int offset, int length)
          Sets the version field of this message.
 void setVersion(String v)
          Sets the version field of this message.
 String toString()
          Return the message as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

encoder

protected final CharsetEncoder encoder

decoder

protected final CharsetDecoder decoder

MINIMUM_SERVER_VERSION

protected static final int MINIMUM_SERVER_VERSION
See Also:
Constant Field Values
Constructor Detail

Message

public Message(CharsetEncoder encoder,
               CharsetDecoder decoder)
Method Detail

setBookmarkSeqNo

public void setBookmarkSeqNo(long val)
Sets the bookmark sequence number for this message. The bookmark sequence number is used by bookmark stores to track messages.


getBookmarkSeqNo

public long getBookmarkSeqNo()
Returns the bookmark sequence number for this message. The bookmark sequence number is used by bookmark stores to track messages.


setSubscription

public void setSubscription(Subscription subscription)
Sets the subscription for this message. The subscription is used by bookmark stores to track messages.


getSubscription

public Subscription getSubscription()
Gets the subscription for this message. The subscription is used by bookmark stores to track messages.


setBuffer

public void setBuffer(byte[] buffer)
Sets the byte buffer used by the message. It's not common for applications to use this directly.

Parameters:
buffer - the byte buffer to use for the message.

getBuffer

public byte[] getBuffer()
Gets the byte buffer used by the message.

Returns:
the raw byte buffer backing this message object.

setRawBufferOffset

public void setRawBufferOffset(int offset)
Sets the offset into the byte buffer where this message begins.

Parameters:
offset - offset of first byte of message within the buffer.

getRawBufferOffset

public int getRawBufferOffset()
Gets the offset into the byte buffer where this message begins.

Returns:
offset of first byte of message within the buffer.

setRawBufferLength

public void setRawBufferLength(int length)
Sets the length of the message within the byte buffer.

Parameters:
length - length of message within the buffer.

getRawBufferLength

public int getRawBufferLength()
Gets the length of the message within the byte buffer.

Returns:
length of message within the buffer.

reset

public void reset()

getAckType

public int getAckType()
Returns the type of acknowledgement for an acknowledgement message.


setAckType

public void setAckType(int v)
Sets the type of acknowledgement for an acknowledgement message.


setAckType

public void setAckType(String v)
Sets the type of acknowledgement for an acknowlegdement message.


getBatchSize

public int getBatchSize()
Returns the batch size for this message.


setBatchSize

public void setBatchSize(int v)
Sets the batch size for this message.


getBookmark

public String getBookmark()
Returns the AMPS bookmark for this message. The bookmark is an idenfitier assigned by AMPS to locate a message in the transaction log.


getBookmarkRaw

public BookmarkField getBookmarkRaw()
Gets the raw value for the AMPS bookmark. The bookmark is an identifier assigned by AMPS to locate a message in the transaction log.


setBookmark

public void setBookmark(String v)
Sets the value for the AMPS bookmark. The bookmark is an identifier assigned by AMPS to locate a message in the transaction log. Setting the bookmark is used for commands that locate messages in the log, such as a bookmark subscribe or historical SOW query. Setting the bookmark on a publish message has no effect.


setBookmark

public void setBookmark(byte[] buffer,
                        int offset,
                        int length)
Sets the value for the AMPS bookmark. The bookmark is an identifier assigned by AMPS to locate a message in the transaction log. Setting the bookmark is used for commands that locate messages in the log, such as a bookmark subscribe or historical SOW query. Setting the bookmark on a publish message has no effect.


getClientName

public String getClientName()
Gets the client name on this message.


getClientNameRaw

public Field getClientNameRaw()
Gets the client name on this message.


setClientName

public void setClientName(String v)
Sets the name of the client sending the message.


setClientName

public void setClientName(byte[] buffer,
                          int offset,
                          int length)
Sets the name of the client sending the message.


getCommandId

public String getCommandId()
Gets the CommandId on this message. The CommandId is an identifier set by the client that is used to correlate later messages. For example, the client sets a CommandId on a subscription request to AMPS, and can later use that CommandId to unsubscribe.


getCommandIdRaw

public Field getCommandIdRaw()
Gets the CommandId on this message. The CommandId is an identifier set by the client that is used to correlate later messages. For example, the client sets a CommandId on a subscription request to AMPS, and can later use that CommandId to unsubscribe.


getCommandId

public boolean getCommandId(CommandId v)
Gets the CommandId on this message by copying it into the provided CommandId object. The CommandId is an identifier set by the client that is used to correlate later messages. For example, the client sets a CommandId on a subscription request to AMPS, and can later use that CommandId to unsubscribe. The CommandId is returned on ack messages in response to the command.

Parameters:
v - the object to hold the value of the CommandId

setCommandId

public void setCommandId(String v)
Sets the CommandId on this message. The CommandId is an identifier set by the client that is used to correlate later messages and commands. For example, the client sets a CommandId on a subscription request to AMPS, and can later use that CommandId to unsubscribe. The CommandId is returned on ack messages in response to the command.


setCommandId

public void setCommandId(CommandId v)
Sets the CommandId on this message. The CommandId is an identifier set by the client that is used to correlate later messages and commands. For example, the client sets a CommandId on a subscription request to AMPS, and can later use that CommandId to unsubscribe. The CommandId is returned on ack messages in response to the command.


setCommandId

public void setCommandId(byte[] buffer,
                         int offset,
                         int length)
Sets the CommandId on this message. The CommandId is an identifier set by the client that is used to correlate later messages and commands. For example, the client sets a CommandId on a subscription request to AMPS, and can later use that CommandId to unsubscribe. The CommandId is returned on ack messages in response to the command.


getCommand

public int getCommand()
Returns the command for this message, indicating the type of of message this is. The fields that are supported by this message, and how they are set and interpreted, depend on the type of message. See the AMPS Command Reference for details.


setCommand

public void setCommand(int v)
Sets the command for this message, indicating the type of of message this is. The fields that are supported by this message, and how they are set and interpreted, depend on the type of message. See the AMPS Command Reference for details.

Parameters:
v - the command to set on this message

setCommand

public void setCommand(String v)
Sets the command for this message, indicating the type of of message this is. The fields that are supported by this message, and how they are set and interpreted, depend on the type of message. See the AMPS Command Reference for details.

Parameters:
v - the command to set on this message. The value provided must be a value supported by the AMPS server, or the server will refuse to process the command.

getData

public String getData()
Returns the payload of the message.


getDataRaw

public Field getDataRaw()
Returns the payload of the message.


setData

public void setData(String v)
Sets the payload of the message.


setData

public void setData(byte[] buffer,
                    int offset,
                    int length)
Sets the payload of the message.


getExpiration

public int getExpiration()
Returns the expiration set for this message.


setExpiration

public void setExpiration(int v)
Sets the expiration set for this message. The expiration is used on a publish command to set the lifetime of a message. For the lifetime to be processed by AMPS, the message must be published to a SOW topic that supports message expiration. See the AMPS User Guide for details.

Parameters:
v - the lifetime of the message

getFilter

public String getFilter()

getFilterRaw

public Field getFilterRaw()
Returns the filter on this message. Filters are used for commands that provide content filtering, such as SOW queries, subscriptions, and SOW delete.


setFilter

public void setFilter(String v)
Sets the filter on this message. Filters are used for commands that provide content filtering, such as SOW queries, subscriptions, and SOW delete.


setFilter

public void setFilter(byte[] buffer,
                      int offset,
                      int length)
Sets the filter on this message. Filters are used for commands that provide content filtering, such as SOW queries, subscriptions, and SOW delete.


getOrderBy

public String getOrderBy()
Get the OrderBy parameter for this message. For commands that support ordering, this parameter provides the order in which AMPS returns results.


getOrderByRaw

public Field getOrderByRaw()
Get the OrderBy parameter for this message. For commands that support ordering, this parameter provides the order in which AMPS returns results.


setOrderBy

public void setOrderBy(String v)
Set the OrderBy parameter for this message. For commands that support ordering, this parameter provides the order in which AMPS returns results. See the AMPS User Guide for details.

Parameters:
v - the ordering expression

setOrderBy

public void setOrderBy(byte[] buffer,
                       int offset,
                       int length)
Set the OrderBy parameter for this message. For commands that support ordering, this parameter provides the order in which AMPS returns results. See the AMPS User Guide for details.

Parameters:
buffer - the buffer that contains the expression
offset - the location at which the expression begins
length - the length of the expression

getGroupSeqNo

public long getGroupSeqNo()
Get the group sequence number. The group sequence number is the number of the batch within the SOW response.


setGroupSeqNo

public void setGroupSeqNo(long v)
Set the group sequence number. The group sequence number is the number of the batch within the SOW response, and is set on incoming messages by the AMPS client.


getMatches

public long getMatches()
Returns the number of matches in the command this message acknowledges. This header is provided on an acknowledgement message that includes information on the number of matches. See the AMPS Command Reference for details.


setMatches

public void setMatches(long v)
Sets the matches field on this message. This header is typically provided by AMPS.

Parameters:
v - the value to set

getMaxMessages

public long getMaxMessages()
Deprecated. This header is no longer used by AMPS.

Gets the max messages header, unused in recent versions of AMPS.


setMaxMessages

public void setMaxMessages(long v)
Deprecated. This header is no longer used by AMPS.

Sets the max messages header, unused in recent versions of AMPS.


getMessageId

public String getMessageId()
Deprecated. This header is no longer used by AMPS.

Gets the max messages header, unused in recent versions of AMPS.


getMessageIdRaw

public Field getMessageIdRaw()
Deprecated. This header is no longer used by AMPS.

Gets the max messages header, unused in recent versions of AMPS.


setMessageId

public void setMessageId(String v)
Deprecated. This header is no longer used by AMPS.

Sets the max messages header, unused in recent versions of AMPS.


setMessageId

public void setMessageId(byte[] buffer,
                         int offset,
                         int position)
Deprecated. This header is no longer used by AMPS.

Sets the max messages header, unused in recent versions of AMPS.


getPassword

public String getPassword()
Returns the password set on the message. This field is typically used during the logon sequence.


getPasswordRaw

public Field getPasswordRaw()
Returns the password set on the message. This field is used during the logon sequence.


setPassword

public void setPassword(String v)
Set the password on the message. This field is typically used during the logon sequence.

Parameters:
v - the password to set

setPassword

public void setPassword(byte[] buffer,
                        int offset,
                        int length)
Set the password on the message. This field is typically used during the logon sequence.

Parameters:
buffer - the buffer that contains the password
offset - the location where the password starts
length - the length of the password

getLength

public int getLength()
Returns the length of the message.


setLength

public void setLength(int v)
Sets the length of the message. This field is typically set by the AMPS client API rather than by application code.


getOptions

public String getOptions()
Returns the options set on this message.


setOptions

public void setOptions(String v)
Sets the options for this message. Options are a comma-delimited list of parameters. The values accepted for options depend on the command: see the AMPS Command Reference for details.


getQueryId

public String getQueryId()
Returns the QueryId for this message. The QueryId returned on a message is the CommandId of the command that ran the query. For example, when sending a SOW command to AMPS, messages returned in response to that command will have the QueryId set to the CommandId of the SOW command.


getQueryIdRaw

public Field getQueryIdRaw()
Returns the QueryId for this message. The QueryId returned on a message is the CommandId of the command that ran the query. For example, when sending a SOW command to AMPS, messages returned in response to that command will have the QueryId set to the CommandId of the SOW command.


getQueryId

public boolean getQueryId(CommandId v)
Returns the QueryId for this message by copying it into the provided CommandId. The QueryId returned on a message is the CommandId of the command that ran the query. For example, when sending a SOW command to AMPS, messages returned in response to that command will have the QueryId set to the CommandId of the SOW command.

Parameters:
v - the CommandId to copy the QueryId into

setQueryId

public void setQueryId(String v)
Sets the QueryId for this message. Typically, the QueryId is set by the AMPS client on incoming messages.

Parameters:
v - the value to set

setQueryId

public void setQueryId(CommandId v)
Sets the QueryId for this message. Typically, the QueryId is set for incoming messages by the AMPS client.

Parameters:
v - the value to set

setQueryId

public void setQueryId(byte[] buffer,
                       int offset,
                       int position)
Sets the QueryId for this message. Typically, the QueryId is set by the AMPS client on incoming messages.

Parameters:
buffer - the buffer containing the QueryId to set
offset - the location where the QueryId begins
position - the length of the QueryId to set

getReason

public int getReason()
Returns the reason value of this message. The reason is set on acknowledgement messages to provide more information about the acknolwedgement.


getReasonText

public String getReasonText()
Returns the reason value of this message. Typically, the reason is set for incoming messages by the AMPS client.


setReason

public void setReason(int v)
Sets the reason value of this message. Typically, the reason is set for incoming messages by the AMPS client.


getRecordsInserted

public long getRecordsInserted()
Returns the number of records inserted for the command that this message was produced in response to. This header is provided on an acknowledgement message that includes information on the number of records inserted. See the AMPS Command Reference for details.


setRecordsInserted

public void setRecordsInserted(long v)
Returns the number of records inserted for the command that this message was produced in response to. This header is provided on an acknowledgement message. An application does not typically need to set this field. See the AMPS Command Reference for details.


getRecordsUpdated

public long getRecordsUpdated()
Returns the number of records updated for the command that this message was produced in response to. This header is provided on an acknowledgement message. See the AMPS Command Reference for details.


setRecordsUpdated

public void setRecordsUpdated(long v)
Sets the records updated header field. This header is provided on an acknowledgement message. An application does not typically need to set this field. See the AMPS Command Reference for details.


getRecordsDeleted

public long getRecordsDeleted()
Returns the number of records deleted for the command that this message was produced in response to. This header is provided on an acknowledgement message. See the AMPS Command Reference for details.


setRecordsDeleted

public void setRecordsDeleted(long v)
Sets the records deleted header field. This header is provided on an acknowledgement message. An application does not typically need to set this field. See the AMPS Command Reference for details.


getRecordsReturned

public long getRecordsReturned()
Returns the number of records returned for the command that this message was produced in response to. This header is provided on an acknowledgement message. See the AMPS Command Reference for details.


setRecordsReturned

public void setRecordsReturned(long v)
Sets the records returned header field. This header is provided on an acknowledgement message. An application does not typically need to set this field. See the AMPS Command Reference for details.


getSendEmpties

public boolean getSendEmpties()
Gets the value of the send empties header. This header is one way of requesting that AMPS send empty messages on a delta subscription. For new applications, using the send_empties option is preferred.


setSendEmpties

public void setSendEmpties(boolean v)
Sets the value of the send empties header. This header is one way of requesting that AMPS send empty messages on a delta subscription. For new applications, using the send_empties option is preferred.

Parameters:
v - the new value

getSendMatchingIds

public boolean getSendMatchingIds()
Gets the value of the send keys header. This header is one way of requesting that AMPS send keys on a delta subscription. For new applications, using the send_keys option is preferred.


setSendMatchingIds

public void setSendMatchingIds(boolean v)
Gets the value of the send keys header. This header is one way of requesting that AMPS send keys on a delta subscription. For new applications, using the send_keys option is preferred.

Parameters:
v - the new value

getSendOOF

public boolean getSendOOF()
Gets the value of the send OOF header. This header is one way of requesting that AMPS send OOF messages for a SOW and subscribe. For new applications, using the oof option is preferred.


setSendOOF

public void setSendOOF(boolean v)
Sets the value of the send OOF header. This header is one way of requesting that AMPS send OOF messages for a SOW and subscribe. For new applications, using the oof option is preferred.

Parameters:
v - the new value

getSequenceRaw

public Field getSequenceRaw()
Returns the sequence number for this message. On outgoing messages, this field is typically set by the AMPS client. The sequence number is used by AMPS for duplicate detection. Each combination of client name and sequence number should be a unique message. In the response to a login, AMPS may return the last sequence number received from a client to assist in recovery.


getSequence

public long getSequence()
Returns the sequence number for this message. On outgoing messages, this field is typically set by the AMPS client. The sequence number is used by AMPS for duplicate detection. Each combination of client name and sequence number should be a unique message. In response to a logon, AMPS may return the last sequence number received from a client to assist in recovery.


setSequence

public void setSequence(long v)
Returns the sequence number for this message. This field is typically set by the AMPS client. The AMPS client uses the sequence number in outgoing messages. The sequence number is used by AMPS for duplicate detection. Each combination of client name and sequence number should be a unique message.


getSowKey

public String getSowKey()
Returns the SowKey for this message. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SowKey on each message.


getSowKeyRaw

public Field getSowKeyRaw()
Returns the SowKey for this message. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SowKey on each message.


setSowKey

public void setSowKey(String v)
Sets the SowKey for this message. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SOW key on each message.

Parameters:
v - the new value for the SOW key

setSowKey

public void setSowKey(byte[] buffer,
                      int offset,
                      int length)
Sets the SowKey for this message. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SOW key on each message.

Parameters:
buffer - the buffer that contains the SOW key
offset - the location within the buffer where the SOW key begins
the - length of the SOW key

getSowKeys

public String getSowKeys()
Gets the set of SowKeys this message applies to. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SOW key on each message.


getSowKeysRaw

public Field getSowKeysRaw()
Gets the set of SowKeys this message applies to. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SOW key on each message.


setSowKeys

public void setSowKeys(String v)
Sets the set of SowKeys this message applies to, as a comma-delimited list of identifiers. This can be useful for commands that operate on multiple SOW records, such as a sow_delete that specifies a set of keys to remove. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SOW key on each message.

Parameters:
v - the new value

setSowKeys

public void setSowKeys(byte[] buffer,
                       int offset,
                       int length)
Sets the set of SowKeys this message applies to, as a comma-delimited list of identifiers. This can be useful for commands that operate on multiple SOW records, such as a sow_delete that specifies a set of keys to remove. The SowKey is an opaque identifier used to uniquely identify a SOW record within AMPS. For messages received from a SOW, AMPS provides the SOW key on each message.

Parameters:
buffer - the buffer that contains the SOW key
offset - the location within the buffer where the SOW key begins
length - the length of the SOW key

getStatus

public int getStatus()
Returns the status of this message. This field is provided by AMPS on acknowledgements to indicate the success or failure of the command being acknowledged.


setStatus

public void setStatus(int v)
Sets the status of this message. This field is provided by AMPS on acknowledgements to indicate the success or failure of the command being acknowledged.


getSubId

public String getSubId()
Gets the SubId of this message. The SubId is a reference to the CommandId of the command that created the subscription.


getSubIdRaw

public Field getSubIdRaw()
Gets the SubId of this message. The SubId is a reference to the CommandId of the command that created the subscription.


getSubId

public boolean getSubId(CommandId v)
Gets the SubId of this message by copying it into the provided CommandId. The SubId is a reference to the CommandId of the command that created the subscription.


setSubId

public void setSubId(String v)
Sets the SubId of this message. The SubId is a reference to the CommandId of the command that created the subscription.


setSubId

public void setSubId(CommandId v)
Sets the SubId of this message. The SubId is the CommandId of the command that created the subscription. For example, to replace a subscription, you provide the SubId of the subscription to be replaced with the command that replaces the subscription.

Parameters:
v - the new value of the SubId

setSubId

public void setSubId(byte[] buffer,
                     int offset,
                     int length)
Sets the SubId of this message. The SubId is a reference to the CommandId of the command that created the subscription. For example, messages returned for a subscription contain the SubId of the subscription.

Parameters:
buffer - the buffer that contains the SubId key
offset - the location within the buffer where the SubId begins
the - length of the SubId

getSubIds

public String getSubIds()
The set of SubIds for this message. AMPS returns a SubId for each subscription that matches the message as a comma-delimited list. The SubId is the identifier provided when the subscription was registered with AMPS.


getSubIdsRaw

public Field getSubIdsRaw()
The set of SubIds for this message. AMPS returns a SubId for each subscription that matches the message as a comma-delimited list. The SubId is the identifier provided when the subscription was registered with AMPS.


setSubIds

public void setSubIds(String v)
The set of SubIds for this message. AMPS returns a SubId for each subscription that matches the message as a comma-delimited list. The SubId is the identifier provided when the subscription was registered with AMPS.


setSubIds

public void setSubIds(byte[] buffer,
                      int offset,
                      int length)
The set of SubIds for this message. AMPS returns a SubId for each subscription that matches the message. The SubId is the identifier provided when the subscription was registered with AMPS.


getTimestamp

public String getTimestamp()
Returns the timestamp for this message, an ISO-8601 formatted string. The timestamp is set by AMPS at the time that AMPS processes the message.


getTimestampRaw

public Field getTimestampRaw()
Returns the timestamp for this message, an ISO-8601 formatted string. The timestamp is set by AMPS at the time that AMPS processes the message.


setTimestamp

public void setTimestamp(String v)
Sets the timestamp for this message. The timestamp is set by AMPS at the time that AMPS processes the message. There is generally no need to set this field in your application.

Parameters:
v - the timestamp to set

setTimestamp

public void setTimestamp(byte[] buffer,
                         int offset,
                         int length)
Sets the timestamp for this message. The timestamp is set by AMPS at the time that AMPS processes the message. There is generally no need to set this field in your application.

Parameters:
buffer - the buffer that contains the timestamp
offset - the location within the buffer where the timestamp begins
length - the length of the timestamp

getTopN

public long getTopN()
Get the TopN parameter for this message. For commands that support limiting the number of messages in the result set, this parameter provides the limit to AMPS.


setTopN

public void setTopN(long v)
Set the TopN parameter for this message. For commands that support limiting the number of messages in the result set, this parameter provides the limit to AMPS.

Parameters:
v - the value to set

getTopic

public String getTopic()
Return the topic that the message applies to.


getTopicRaw

public Field getTopicRaw()
Return the topic that the message applies to.


setTopic

public void setTopic(String v)
Set the topic that the message applies to.

Parameters:
v - the topic to set

setTopic

public void setTopic(byte[] buffer,
                     int offset,
                     int length)
Set the topic that the message applies to.

Parameters:
buffer - the buffer that contains the timestamp
offset - the location within the buffer where the timestamp begins
length - the length of the timestamp

getTopicMatches

public long getTopicMatches()
Returns the number of matching topics for the command that this message was produced in response to. This header is provided on an acknowledgement message that includes information on the number of records inserted. See the AMPS Command Reference for details.


setTopicMatches

public void setTopicMatches(long v)
Sets the topic matches field on this message. This header is typically provided by AMPS.

Parameters:
v - the value to set

getUserId

public String getUserId()
Get the UserId for this message. This field is typically set during the logon sequence. The field may also be provided on published messages, depending on the authentication used in AMPS. When provided on a published message, AMPS provides the identity of the connection that sent the message, not the value provided with the message as published.


getUserIdRaw

public Field getUserIdRaw()
Get the UserId for this message. This field is typically set during the logon sequence. The field may also be provided on published messages, depending on the authentication used in AMPS. When provided on a published message, AMPS provides the identity of the connection that sent the message, not the value provided with the message as published.


setUserId

public void setUserId(String v)
Set the UserId for this message. This field is typically set during the logon sequence. The field may also be provided on published messages, depending on the authentication used in AMPS. When provided on a published message, AMPS provides the identity of the connection that sent the message, not the value provided with the message as published. Therefore, applications generally only set this value during logon.

Parameters:
v - the UserId to set

setUserId

public void setUserId(byte[] buffer,
                      int offset,
                      int length)
Set the UserId for this message. This field is typically set during the logon sequence. The field may also be provided on published messages, depending on the authentication used in AMPS. When provided on a published message, AMPS provides the identity of the connection that sent the message, not the value provided with the message as published. Therefore, applications generally only set this value during logon.

Parameters:
buffer - the buffer that contains the UserId
offset - the position where the UserId begins
length - the length of the UserId

getVersion

public String getVersion()
Returns the version of the AMPS server, provided in response to a logon.


getVersionRaw

public Field getVersionRaw()
Returns the version of the AMPS server, provided in response to a logon.


getVersionAsInt

public int getVersionAsInt()
Returns the version of the AMPS server, provided in response to a logon.


setVersion

public void setVersion(String v)
Sets the version field of this message. This is typically done by the AMPS client API when a message with this field set is received.

Parameters:
v - the version to set

setVersion

public void setVersion(byte[] buffer,
                       int offset,
                       int length)
Sets the version field of this message. This is typically done by the AMPS client API when a message with this field set is received.

Parameters:
buffer - the buffer that contains the version string
offset - the position where the version string begins
length - the length of the version string

setCorrelationId

public void setCorrelationId(String v)
Set the CorrelationId on this message. The CorrelationId is an opaque identifier provided by the publisher of a message. AMPS provides the identifier to subscribers of the message without interpreting or changing the identifier.

Parameters:
v - the value to set

getCorrelationId

public String getCorrelationId()
Get the CorrelationId on this message. The CorrelationId is an opaque identifier provided by the publisher of a message. AMPS provides the identifier to subscribers of the message without interpreting or changing the identifier.


getCorrelationIdRaw

public StringField getCorrelationIdRaw()
Get the CorrelationId on this message. The CorrelationId is an opaque identifier provided by the publisher of a message. AMPS provides the identifier to subscribers of the message without interpreting or changing the identifier.


toString

public String toString()
Return the message as a string. This serializes the message and returns the serialized value.

Overrides:
toString in class Object

copy

public abstract Message copy()

_copyTo

protected void _copyTo(Message destination)