Skip to content

Instantly share code, notes, and snippets.

@rickhanlonii
Last active December 20, 2015 07:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickhanlonii/6091542 to your computer and use it in GitHub Desktop.
Save rickhanlonii/6091542 to your computer and use it in GitHub Desktop.
As posted on HN. Example of adding more queues/consumers to andreimarcu/aamnoifs.
import notifs
def print_notification(title, message):
print "Notification received: {0}: {1}".format(title, message)
def web_app_notify(title, message):
print "Webapp notification received: {0}: {1}".format(title, message)
def iphone_app_notify(title, message):
print "iPhone App notification received: {0}: {1}".format(title, message)
def android_app_notify(title, message):
print "Android App notification received: {0}: {1}".format(title, message)
try:
n = notifs.Notifs("amqps://user:password@domain.tld:5673/%2F")
n.receive("routing_name", print_notification)
n.receive("routing_name", web_app_notify)
n.receive("routing_name", iphone_app_notify)
n.receive("routing_name", android_app_notifify)
except KeyboardInterrupt:
break
# https://github.com/andreimarcu/aamnotifs
# https://news.ycombinator.com/item?id=6109977
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment