Permalink
Browse files

bidirectional communication with redis

  • Loading branch information...
1 parent c9762a8 commit c45f05f930feff8a4c676c07925f14466ec603d1 @heynemann committed Jul 10, 2012
Showing with 498 additions and 0 deletions.
  1. +8 −0 Makefile
  2. 0 r3/__init__.py
  3. +12 −0 r3/sender.py
  4. +18 −0 r3/worker.py
  5. +460 −0 redis.conf
View
@@ -0,0 +1,8 @@
+
+# %%%%%%%%%%%%%% REDIS %%%%%%%%%%%%%%
+kill_redis:
+ @ps aux | awk '(/redis-server/ && $$0 !~ /awk/){ system("kill -9 "$$2) }'
+
+redis: kill_redis
+ @mkdir -p /tmp/r3/db
+ @redis-server redis.conf &
View
No changes.
View
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import redis
+
+def main():
+ client = redis.StrictRedis(host='localhost', port=7778, db=0, password="r3")
+ client.publish('some-event', 'some-data')
+
+if __name__ == '__main__':
+ main()
+
View
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import redis
+
+def main():
+ client = redis.Redis(host='localhost', port=7778, db=0, password="r3")
+ pubsub = client.pubsub()
+
+ pubsub.subscribe(['some-event'])
+
+ while True:
+ print "waiting for next item..."
+ result = pubsub.listen().next()
+ print result
+
+if __name__ == '__main__':
+ main()
Oops, something went wrong.

0 comments on commit c45f05f

Please sign in to comment.