6. Utility Commands

flush

Description

Sends a command to AMPS that returns an acknowledgment when all previous commands from this client have been processed. This command helps applications that use AMPS determine when AMPS has received all of the messages that have been sent, making it safe for the client to exit.

Header Fields

Table 6.1 contains the header fields available to a flush command.

Field Description
Command
The command to be executed. Value: flush.
ClientName
A string identifier used to give a client a unique id.
AckType Acknowledgment type for the given command. Value is a comma separated list of one or more of the following: none, completed or processed.

Table 6.1: Header fields supported by flush

Returns

A flush message specifying an AckType of completed or processed will receive an ack message when all previous messages from this client have been processed by AMPS.

Table 6.2 contains the acknowledgment messages that can be returned by a logon command.

Acknowledgment Description
none No ack message is returned. This is the default behavior.
completed All previous commands have been processed by AMPS.
persisted Not supported at this time.
processed AMPS has processed the flush message.
received The flush command has been received.
stats Not supported at this time.

Table 6.2: Acknowledgment messages supported by logon

heartbeat

Description

Sends a command to AMPS that starts or refreshes a heartbeat timer. When a heartbeat timer is active, AMPS publishes periodic heartbeat messages to AMPS and expects the client to respond with a heartbeat message. If the client does not provide a heartbeat within the time specified, AMPS logs an error and disconnects the connection.

Header Fields

Table 6.3 contains the header fields available to a heartbeat command.

Field Description
Command
The command to be executed. Value: heartbeat.
Options

Specifies whether this command starts the timer or refreshes the timer. Valid options are:

  • start, immediately followed by an interval. This option specifies that the command starts a timer, and sets the interval at which AMPS will expect heartbeat messages. For example, to specify an interval of 5 seconds, the option is start,5
  • beat. This option specifies that the command refreshes the heartbeat timer.

Table 6.3: Header fields supported by heartbeat

Returns

The heartbeat message does not typically request an acknowledgment, and therefore does not receive a response. The command can, however, request acknowledgments as listed below.

Acknowledgment Description
none Not supported at this time.
completed Not supported at this time.
parsed Not supported at this time.
persisted Not supported at this time.
processed AMPS has processed the heartbeat message.
received AMPS has received the heartbeat message.
stats Not supported at this time.

Table 6.4: Acknowledgment messages supported by heartbeat