Using the State of the World
State of the World topics are used for several different purposes:
Queries / Point in Time Database
At any point in time, applications can issue SOW queries to retrieve all of the messages that match a given topic and content filter. When a query is executed, AMPS will test each message in the SOW against the content filter specified and all messages matching the filter will be returned to the client. The topic can be a literal topic name or a regular expression pattern. For more information on issuing queries, please see the section on Querying the State of the World (SOW).
Atomic Query and Subscribe
If the application needs to receive updates or needs the ongoing state of the topic rather than running a one-time query, the application can query the State of the World and simultaneously subscribe to updates to the topic. This is typically much more efficient than running repeated queries of the topic.
This command, sow_and_subscribe
, is described in the Query and Subscribe topic in the Querying the State of the World (SOW) section.
Enable Advanced Messaging Features
Because the State of the World maintains a record of the current state of messages, it enables several of the advanced messaging features provided by AMPS.
Out-of-Focus Messages
A subscription to a topic can optionally request to be notified when a message is removed or no longer matches the subscription when the topic is recorded in the State of the World. See the Out-of-Focus Messages section for details.
Message Enrichment
AMPS can optionally enrich messages when they are published to a topic that is recorded in the State of the World. The enrichment can include logic based on the previous state of the message. See the State of the World Message Enrichment section for details.
Publishing Incremental Updates
Because a topic stored in the State of the World maintains the current value of a message, applications do not need to republish the full message when making updates to a message. See the Incremental Message Updates section for details.
Aggregation and Analysis
Since a State of the World topic maintains a complete set of current values for a topic, a State of the World topic is the foundation of analysis and aggregation of the messages published to a topic. See the Aggregation and Analytics section for more details.
Receiving Updated Fields Only
When a message in the State of the World is replaced or updated, AMPS can determine which fields (if any) have changed from the previous values. A subscriber can optionally request to be delivered only fields that have changed from the previous values. See Receiving Only Updated Fields for details.
Application Scenarios
The topics titled When Should I Store a Topic in the SOW and Scenario and Feature Reference in the Introduction to AMPS provide an introduction to some of the application scenarios that can benefit from using a State of the World topic.
Last updated