Is there a way to store client state in AMPS?

Yes, the AMPS SOW provides a convenient way to store persistent client state while minimizing external dependencies.

The general approach is:

  • Define a message format that contains the state you need to preserve, including a consistent identifier for each distinct instance of your application

  • Configure a SOW topic to store the messages

  • In your application, query the SOW and restore the application state when the application starts

  • Periodically persist the application state as the application runs

If you need to store the state of bookmark subscriptions in AMPS, recent versions of the AMPS clients provide a bookmark store adapters to provide storage for bookmarks in AMPS. (Of course, as always with the AMPS clients, the source code for the adapters is provided.) See the Developer Guide for your language of choice for details.

For a do-it-yourself route, 60East has provided examples of this approach on the 60East blog -- each example is a variation on the approach above, and each example solves a slightly different problem:

Keeping Bookmark State in AMPS: http://www.crankuptheamps.com/blog/posts/2015/03/09/no_filesystem_no_problem_keeping_state_in_amps/

Handling Poison Messages: http://www.crankuptheamps.com/blog/posts/2015/01/30/yuck-stateless-poison-message-handling/

Keywords: SOW storage, client state, bookmark store

Last updated