Does AMPS return messages from the SOW in the order published?


AMPS doesn't guarantee any particular order for SOW messages. If you need to determine the order in which a client published messages, we recommend adding a field containing a timestamp to the message.

As of AMPS 4.0, AMPS supports an OrderBy parameter for SOW queries, which allows you to specify the order in which AMPS returns results. The order is based on the contents of the message.  For example, if the messages have a timeEntered field that records the time at which the publisher created the message, you could return messages in the order in which they were entered by using /timeEntered ASC as the OrderBy parameter for the query.

Have more questions? Submit a request


  • Avatar
    Alexander Cerna

    In the Command Reference (v4.3) document, Table 34 Header fields supported by SOW mentions a Timestamp header field. If I call Message.get_timestamp() in Python on a SOW message, will I always get a timestamp, e.g., "20151209T202333.168976Z" to latch onto?

  • Avatar
    Dirk Myers

    The field will always be present on the Python object. However, in 4.3, AMPS sends a timestamp only if you request the "timestamp" option on the sow (or sow_and_subscribe) command. This prevents the timestamp from taking up network bandwidth if the application isn't going to use it, and provides backward compatibility with versions of AMPS that didn't support this header.

  • Avatar
    Alexander Cerna

    Hello Dirk,

    Much thanks as always. Your answer helps a lot!


Powered by Zendesk