Skip to main content

flush command

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.

tip

Notice that the publishFlush command available in the AMPS client libraries includes additional logic (when a PublishStore is present) to ensure that messages published to AMPS have been safely persisted.

Header Fields

The following table contains the header fields available to a flush command.

FieldDescription
cmd

The command to be executed.

Value: flush

client_nameA string identifier used to give a client a unique ID.
ack_type

Acknowledgment type for the given command.

Value is a comma separated list of one or more of the following: none, completed or processed.

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.

The following table contains the acknowledgment messages that can be returned by a flush command.

AcknowledgmentDescription
none

No ack message is returned.

This is the default behavior.

completedAll previous commands have been processed by AMPS.
persistedAll previous commands from this publisher have been persisted by AMPS (or have failed and produced the requested acknowledgments).
processedAMPS has processed the flush message.
receivedThe flush command has been received.
statsNot supported at this time.