Created
April 11, 2012 17:08
-
-
Save wraithan/2360601 to your computer and use it in GitHub Desktop.
Shows that messages are queued.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
client = redis.StrictRedis() | |
pubsub = client.pubsub() | |
pubsub.subscribe('in') | |
# in redis: 1334163648.749540 "SUBSCRIBE" "in" | |
client2 = redis.StrictRedis() | |
client2.publish('in', 'meh1') | |
# in redis: 1334163693.949203 "PUBLISH" "in" "meh1" | |
client2.publish('in', 'meh2') | |
# in redis: 1334163697.516875 "PUBLISH" "in" "meh2" | |
for message in pubsub.listen(): | |
print(message) | |
# {'pattern': None, 'type': 'message', 'channel': 'in', 'data': 'meh1'} | |
# {'pattern': None, 'type': 'message', 'channel': 'in', 'data': 'meh2'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment