Command Acknowledgment
AMPS command processing is designed to be asynchronous. The design of the server makes it possible for an application to send a command to AMPS, and receive the results of that command at a later time. Acknowledgment of commands is always optional: the server makes no requirement that an application request acknowledgment. The AMPS client libraries automatically request the acknowledgments required to maintain the guarantees the client API provides.
The status and results of a command are returned to a client in the form of an acknowledgment, or ack
, message. AMPS can return status updates at various checkpoints throughout the command processing sequence.
For many applications, it may not be necessary for the application to request message acknowledgments explicitly. The AMPS clients request a set of acknowledgments by default that balance performance with error detection.
AMPS supports a variety of ack
types, and allows you to request multiple ack
types on each command. For example, the received ack
type requests that AMPS acknowledge when the command is received, while the completed ack
type requests that AMPS acknowledge when it has completed the command (or the portion of the command that runs immediately). Each AMPS command supports a different set of types, and the precise meaning of the ack
returned depends on the command that AMPS is acknowledging.
AMPS commands are inherently asynchronous, and AMPS does not provide acknowledgment messages by default. A client must both explicitly request an acknowledgment and then receive and process that acknowledgment to know the results of a command. It is normal for time to elapse between the request and the acknowledgment, therefore AMPS acknowledgments provide a way to correlate the acknowledgment with the command that produced it. This is typically done with an identifier that the client assigns to a command, which is then returned in the acknowledgment for the command.
AMPS supports the acknowledgment types listed in the following table:
Acknowledgment Type
Description
completed
The command (or a portion of the command) has completed.
persisted
The results of the command have been persisted to durable storage.
processed
AMPS has processed the command.
received
AMPS has received the command.
stats
AMPS returns statistics associated with the command.
Acknowledgments for different commands may not arrive in the order that commands were submitted to AMPS. For example, a publish
command to a topic that uses synchronous replication will not return a persisted
acknowledgment until the synchronous replication destinations have persisted the message. If the client issues a subscribe
command in the meantime, the processed
acknowledgment for the subscribe
command -- indicating that AMPS has processed the subscription request -- may well return before the persisted
acknowledgment.
Not all commands support all acknowledgment types, and the meaning of each acknowledgment may differ depending on the command submitted. The acknowledgments for different commands set different fields on an acknowledgment message. If an acknowledgement type is not specified for a given command, AMPS does not make specific guarantees as to when (or if) that acknowledgement is returned for that command.
See the AMPS Command Reference for details.
Last updated