Removing Messages (SOW/Topic or Message Queue)
In AMPS, there are three different ways to remove records from the SOW. The first method is to construct a publish
message that matches the message to be removed, with the Command
field set to be a sow_delete
message. This has the net effect of causing AMPS recreate the SowKey
for the particular message, then look up the SowKey
message in the SOW and finally remove it.
The other method to remove messages from the SOW is to construct a sow_delete
message and pass in a comma separated list of SowKey
s in the message header which will cause all of the messages to be removed from the SOW Topic.
The third way to remove records from the SOW is similar to the manner in which a sow
query command with a filter
is performed. In this case, instead of returning the results of the sow
command, those records that match the filter will be deleted from the SOW.
The sow_delete
command is also used to acknowledge messages from a queue. With this form of sow_delete
, a client sends one or more bookmarks (as a comma-delimited list) that specify the messages to acknowledge. This form can only be used for acknowledging messages from a queue topic.
Header Fields
The following table contains the header fields supported by a sow_delete
.
Field | Description |
| Command to be executed. Value: |
| The SOW topic from which to delete the messages(s). |
| Acknowledgment type for the given command. Value is a comma separated list of one or more of the following: |
| If specified with an AMPS command requesting an |
| A comma separated list of unique ids to be deleted. AMPS uses these IDs to locate and remove the specified records. Notice that these values are the internal ID used by AMPS -- the To use the values of fields in the message to locate the records to remove, use a |
| Content filter expression. See the Content Filtering chapter in the AMPS User Guide for more information on using content filters. When provided, AMPS removes the matching records. |
| Message data that identifies the record to be removed. When provided, AMPS uses this |
| Processed when the When this option is used, the message must have been provided from a message queue, and the |
| Available when the When a value of When a value of |
The SowKeys
, Filter
, Data
and Bookmark
header fields cannot be used together. They are mutually exclusive. Using them together in the same sow_delete
command will cause indeterminate results.
The Bookmark
header can only be used to acknowledge messages from queue topics.
Returns
For a sow_delete
message, AMPS will send acknowledgment message, completed
and stats
for the following acknowledgment message types: received
, processed
and persisted
along with a populated Status
header field describing the acknowledgment.
Acknowledgment | Description |
| No acknowledgment message is returned. This is the default behavior. |
| Supported for a The |
| When an AMPS engine returns an acknowledgment message of 1. All downstream synchronous replication(s) have acknowledged that the message(s) have been deleted from their respective SOW topic(s). 2. The |
| AMPS has compiled the filter(s) for the |
| The |
| Returns an acknowledgment message with |
The stats
acknowledgment message include three values in the header, Matches
, TopicMatches
and the RecordsDeleted
. These are defined below:
TopicMatches
The total number of records compared across all matching SOW topics.
Matches
The number of records returned that match the topic regular expression and the content filter.
RecordsDeleted
The total number of records deleted.
Errors
Errors that occur during a sow_delete
are returned as part of the processed
acknowledgment message and recorded to the log. Typical errors involved a missing topic, or a missing/invalid SowKey
.
Last updated