There several ways to get the number of records in a SOW topic without pulling every record into the client. Here are the best ways in order of preference:
You can request a
statsacknowledgement with a
TopNvalue of 0 in a
sowquery. This will execute a SOW query against the topic, but not return any records to your client. After the query is complete, AMPS will return a
statsacknowledgement to your client containing the total number of messages evaluated for the query. If you're using just a single topic (not a regex pattern covering multiple topics) then this number is the number of records within the SOW topic. This approach has the advantage that you can run the exact query that you need information on, including content filtering and regex topics.
You can subscribe to the
/AMPS/SOWStatstopic (or query it if you're capturing it to its own SOW topic). AMPS publishes statistics information to this topic. You can find more details on this approach in the AMPS User Guide. With this approach, you only get information about whole topics, and you need to monitor, and store messages from the subscription (or the results of the query) to be able to use the information.
You can issue a HTTP GET request to the Administrative interface programmatically and get the number of "valid_keys" for the SOW topic. More information on that approach is available in the AMPS Monitoring Reference. This may be the best way to get the information if you need the number of records for an application (like a dashboard) that is already using the Administrative interface, and that doesn't otherwise use the AMPS client libraries.
The bottom line here is that there are several ways to get the information.
keywords: SOW size, SOW records