spark sow
The sow command allows the AMPS spark CLI to query the latest messages which have been persisted to a topic. The SOW in AMPS acts as a database last update cache, and the sow command in AMPS spark CLI is one of the ways to query the database. This sow command supports regular expression topic matching and content filtering, which allow a query to be very specific when looking for data.
For the sow command to succeed, the topic queried must provide a SOW. This includes SOW topics and views, queues, and conflated topics. These features of AMPS are discussed in more detail in this guide.
Common Options - spark sow
| Option | Definition |
|---|---|
| AMPS server to connect to. |
| Topic to query. |
batchsize | Batch Size to use during query. A batch size > 1 can help improve performance, as described in Querying the State of the World. |
copy | Publishes records to the secondary server specified. |
filter | The 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 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 query response 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 -server localhost:9007 -type json -topic order \
-filter "/id = '1'"
{ "id" : 1, "data" : "hello, world" }
Total messages received: 1 (Infinity/s)
This sow command will query the order topic and filter results which match the xpath expression /id = '1'. This query will return the results in the topic, for example, the record published in the single-message publish example.
If the topic does not provide a SOW, the command returns an error indicating that the command is not valid for that topic.
For the full range of options, run spark help sow. See AMPS spark CLI Authentication and AMPS spark CLI Support for TCPS for shared connection settings.