spark sow_and_subscribe
The sow_and_subscribe command is a combination of the sow command and the subscribe command. When a sow_and_subscribe is requested, AMPS will first return all messages which match the query and are stored in the SOW. Once this has completed, all messages which match the subscription will then be sent to the client as they update the topic.
The sow_and_subscribe is a powerful tool to use when it is necessary to examine both the contents of the SOW, and the live subscription stream.
Common Options - spark sow_and_subscribe
| Option | Definition |
|---|---|
| AMPS server to connect to. |
| Topic to query and subscribe to. |
batchsize | Batch size to use during query. |
copy | Publishes records to the secondary server specified. |
delta | Request delta for subscriptions (sends a sow_and_delta_subscribe command to AMPS). |
filter | Content filter to use. |
format | Optional format used for displaying messages. May contain literal separator characters mixed with format tags. Allowed tags are:
Notice that not all headers may be available on every request, depending on the options provided to the request. See the AMPS Command Reference for details. Example: |
orderby | An expression that AMPS will use to order the SOW query results. |
proto | Protocol to use. In this release, AMPS spark CLI supports Defaults to |
| Specifies whether to use an SSL-secured connection ( Values: Default: |
topn | Request AMPS to limit the SOW query results to the first N records returned. |
type | For protocols and transports that accept multiple message types on a given transport, specifies the message type to use. |
uriopts | Custom connection URI parameters to be passed in the URI query string. For example: |
| Allows a custom URI scheme to be specified. When both |
Examples
%> ./spark sow_and_subscribe -server localhost:9007 -type json \
-topic chaos -filter "/name = 'cup'"
{ "name" : "cup", "place" : "cupboard" }
The example above queries the chaos topic for stored messages that match /name = 'cup', then subscribes to matching updates. Initially, only matching messages stored in the SOW are returned. If a publisher were started that published data to the topic that matched the content filter, those messages would then be printed out to the screen in the same manner as a subscription.
For the full range of options, run spark help sow_and_subscribe. See AMPS spark CLI Authentication and AMPS spark CLI Support for TCPS for shared connection settings.