Persisting Event Topics

By default, AMPS event topics are not persisted to the SOW. However, because AMPS event topic messages are treated the same as all other messages, the event topics can be persisted to the SOW. Providing a topic definition with the appropriate Key definition can resolve that issue by instructing AMPS to persist the messages.

The Key definition you specify must match the field name used for the message type specified in the SOW topic. That is, to track distinct records by client name for a SOW that uses json, you would use the following key:

<Key>/client_name</Key>

While to track distinct records by client name for a SOW that uses fix, you would use the following key:

<Key>/20067</Key>

For example, to persist the last /AMPS/SOWStats message for each topic in fix, json and xml format, the following Topic sections could be added to the SOW section of the AMPS configuration file:

<SOW>
    <!-- Persist /AMPS/SOWStats in FIX format -->
    <Topic>
        <Name>/AMPS/SOWStats</Name>
        <FileName>./sow/sowstats.fix.sow</FileName>
        <MessageType>fix</MessageType>
        <!-- use FIX field for the key -->
        <Key>/20066</Key>
    </Topic>

    <!-- Persist /AMPS/SOWStats in JSON format -->
    <Topic>
        <Name>/AMPS/SOWStats</Name>
        <FileName>./sow/sowstats.json.sow</FileName>
        <MessageType>json</MessageType>
        <!-- use the JSON field for the key -->
        <Key>/topic</Key>
    </Topic>

    <!-- Persist /AMPS/SOWStats in XML format -->
    <Topic>
        <Name>/AMPS/SOWStats</Name>
        <FileName>./sow/sowstats.xml.sow</FileName>
        <MessageType>xml</MessageType>
        <!-- use the XML field for the key -->
        <Key>/Topic</Key>
    </Topic>
</SOW>

Every time an update occurs, AMPS will persist the /AMPS/SOWStats message and it will be stored three times, once to the fix SOW topic, once to the json SOW topic, and once to the xml SOW topic. Each update to the respective SOW topic will overwrite the record with the same 20066, topic or Topic tag value. Doing this allows clients to now query the SOWStats topic instead of actively listening to live updates.

Last updated

Copyright 2013-2024 60East Technologies, Inc.