What is the difference between a Topic in the SOW and the Transaction Log?

A Topic defined in the State of the World directs AMPS to maintain the current value for an individual message in the topic. The Topic configuration also specifies how the AMPS server distinguishes different messages (typically, by providing a Key).

The transaction log includes a full record of publishes to a topic.

  • Use a Topic in the State of the World if your application needs to know the current state of a message (for example, a given order).

  • Use a Transaction Log if your application needs to be able to recover the full set of messages that were published to a topic, including being able to restart a subscription exactly where it left off (without missing messages).

Let's say that the topic Orders is defined in the SOW with a Key of /id and is also recorded in the the transaction log.

The following messages are published to the topic:

{"id":1, "data":"original publish"}
{"id":2, "data":"another message"}
{"id":1, "data":"an update"}
{"id":1, "data":"more information"}

The Topic in the state of the world would contain the following messages:

{"id":2, "data":"another message"}
{"id":1, "data":"more information"}

These are the most recent updates for each distinct message.

The transaction log, on the other hand, would contain the full set of updates, in the order in which they were published:

{"id":1, "data":"original publish"}
{"id":2, "data":"another message"}
{"id":1, "data":"an update"}
{"id":1, "data":"more information"}

A State-of-the-World Topic and the Transaction Log each maintain their own, separate storage. Queries of the State-of-the-World Topic use the SOW Topic storage. Replays from the transaction log use the transaction log storage.

Last updated