How do I subscribe to a view or an aggregate in my program?

There's nothing special that you need to do in a program to subscribe to a view or an aggregate. You can use the same code that you would use to subscribe to any other topic. For example, in Python:

import AMPS

client = AMPS.Client("subscriber")
client.connect("tcp://amps.host:9007/json")

for msg in client.subscribe("mytopic"):
  print msg.get_data()

This code works regardless of whether mytopic is a view, an aggregate, a topic with a SOW, or a simple pub-sub topic that doesn't use advanced features of AMPS.

Last updated