Cookbook: SOW and Delta Subscribe
This section presents common recipes for atomic SOW and Delta Subscribe in AMPS using the Command
or Message
interfaces. This section provides information on how to configure the request to AMPS. You can adapt this information to your application and the specific interface you are using.
Command: sow_and_delta_subscribe
Basic SOW and Delta Subscribe
In its simplest form, a SOW and Delta Subscribe needs only the topic to query and subscribe to.
Topic
(required)
Sets the topic to query and subscribe to. The topic specified can be the literal topic name, or a regular expression that matches multiple topics.
SOW and Delta Subscribe with Options
In its simplest form, a SOW and Delta Subscribe needs only the topic to query and subscribe to. To add options to the subscription, set the Options
header on the Command
.
Topic
(required)
Sets the topic to query and subscribe to. The topic specified can be the literal topic name, or a regular expression that matches multiple topics.
Options
A comma-delimited set of options for this command. See the sow_and_delta_subscribe
section for a full description of supported options. The most common options for this command are:
oof
- Request out of focus notifications.timestamp
- Include timestamps on messages.
SOW and Delta Subscribe with Content Filter
To provide a content filter on a SOW and Delta Subscribe, set the Filter
property on the command. The AMPS User Guide provides details on the filter syntax.
Topic
(required)
Sets the topic to query and subscribe to. The topic specified can be the literal topic name, or a regular expression that matches multiple topics.
Filter
Sets the content filter to be applied to the query. Only messages that match the content filter will be returned in response to the query.
Paginated SOW and Delta Subscribe
To request a paginated subscription for a SOW and Delta Subscribe, set the Options
property on the command to specify the number of records to return and the number of records to skip before returning records. Most paginated subscriptions also specify the oof
option to be notified when a record is out of focus.
Topic
(required)
Sets the topic to query and subscribe to. The topic specified can be the literal topic name, or a regular expression that matches multiple topics.
OrderBy
Specifies how to order the results within the paginated result set. If the OrderBy
is not provided, the results are ordered by the SowKey
for the messages.
Options
A comma-separated list of options for the command. Set the number of results returned with top_n
, and the starting point within the result set with skip_n
. For example, to display records 31-50 of the result set, you could provide the following option:
top_n=20,skip_n=30,oof
This tells AMPS to skip the first 30 records of the result set, and then provide the top 20 records from the remaining results. Out of focus notifications will be provided.
Aggregated SOW and Delta Subscribe
An Aggregated SOW and Delta Subscribe is a command that provides aggregation options. To add these options to the command, set the Options
header on the Command
.
Topic
(required)
Sets the topic to query and subscribe to. The topic specified can be the literal topic name, or a regular expression that matches multiple topics.
Options
A comma-delimited set of options for this command. For an aggregated SOW and delta subscribe, the options provide the projection
and grouping
for the command. A SOW and delta subscribe can provide options in addition to the projection
and grouping
. The most common additional options are:
oof
- Request out of focus notifications.timestamp
- Include timestamps.no_empties
- Do not send a delta message if the update does not change the value of a field.
Last updated