Cookbook: SOW and Subscribe
This section presents common recipes for atomic SOW and 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_subscribe
Basic SOW and Subscribe
In its simplest form, a SOW and Subscribe command needs only the topic to query and subscribe to.
Header | Comment |
---|---|
| 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 Subscribe with Options
In its simplest form, a SOW and Subscribe command needs only the topic to query and subscribe to. To add options to the subscription, set the Options
header on the Command
.
Header | Comment |
---|---|
| 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. |
| A comma-delimited set of options for this command. See the
|
SOW and Subscribe with Select List
In its simplest form, a SOW and Subscribe command needs only the topic to query and subscribe to. To add options to the subscription, set the Options
header on the Command
. To use a select list, include the specifier for the select list in the options provided.
Header | Comment |
---|---|
| 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. |
| A comma-delimited set of options for this command. See the |
SOW and Subscribe with Content Filter
To provide a content filter on a SOW and Subscribe command, set the Filter
property on the command. The AMPS User Guide provides details on the filter syntax.
Header | Comment |
---|---|
| 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. |
| 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. |
Conflated SOW and Subscribe
To request conflation on the subscription for a SOW and Subscribe command, set the Options
property on the command to specify the conflation interval. When the topic has a SOW (including a view or a conflated topic), there is no need to provide a conflation_key
.
Header | Comment |
---|---|
| 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. |
| A comma-separated list of options for the command. Set the conflation interval in the options. For example, to set a conflation interval of 250 milliseconds, provide the following option: |
Paginated SOW and Subscribe
To request a paginated subscription for a SOW and Subscribe command, 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.
Header | Comment |
---|---|
| Sets the topic to query and subscribe to. The topic specified must be a literal topic name. Pagination is not supported with regular expression subscriptions. |
| Specifies how to order the results within the paginated result set. If the |
| A comma-separated list of options for the command. Set the number of results returned with |
Historical SOW and Subscribe
To create a historical SOW query with a subscription, set the Bookmark
property on the command. The property can be either a specific bookmark or a timestamp. The AMPS User Guide provides details on creating timestamps. This command is only supported on SOW topics that are recorded in an AMPS transaction log.
When History
is enabled for the SOW topic, the Bookmark
provided must be a timestamp or a specific bookmark value, including the special values NOW
(0|1|
) or EPOCH
(0
).
If the Bookmark
provided is a value other than NOW
(0|1|
), the SOW topic must have History
enabled.
Header | Comment |
---|---|
| 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. |
| Sets the historical point in the SOW at which to query. The query returns the saved state of the records in the SOW as of the point in time specified in this header. |
Historical SOW and Subscribe with Content Filter
To create a historical SOW query with a subscription, set the Bookmark
property on the command. The property can be either a specific bookmark or a timestamp. The AMPS User Guide provides details on creating timestamps. This command is only supported on SOW topics that are recorded in an AMPS transaction log. If the Bookmark
provided is a value other than NOW (0|1|
), the SOW topic must have History
enabled.
Header | Comment |
---|---|
| 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. |
| Sets the historical point in the SOW at which to query. The query returns the saved state of the records in the SOW as of the point in time specified in this header. |
| Sets the content filter to be applied to the query. Only messages that match the content filter will be provided to the query. |
Aggregated SOW and Subscribe
An aggregated SOW and Subscribe command is a command that provides aggregation options. To add these options to the sow_and_subscribe
command, set the Options
header on the Command
.
Header | Comment |
---|---|
| 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. |
| A comma-delimited set of options for this command. For an aggregated subscription, the options provide the
|
Last updated