Created
May 27, 2014 00:41
-
-
Save mazz/6a74a085e8557f3b1c69 to your computer and use it in GitHub Desktop.
pika ampq pyramid error
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
#function to get data from queue | |
def _get_tweets(size=10): | |
tweets = [] | |
# Get ten messages and break out | |
count = 0 | |
message_count = _queue_message_count() | |
print("size: " + str(size) + " message_count: " + str(message_count)) | |
if message_count > 0: | |
print("got here if") | |
for method_frame, properties, body in channel.consume('twitter_topic_feed'): | |
print("got here for %i" % count) | |
# Escape out of the loop after 10 messages or if we reached message_count before that | |
if count == size or count == message_count: | |
print("count break") | |
break | |
print("count: " + str(count)) | |
tweets.append(json.loads(body)) | |
print("got here append") | |
# Acknowledge the message | |
channel.basic_ack(method_frame.delivery_tag) | |
print("got here basic_ack") | |
count += 1 | |
print("got here +1") | |
# Cancel the consumer and return any pending messages | |
requeued_messages = channel.cancel() | |
print 'Requeued %i messages' % requeued_messages | |
return tweets | |
hannam@mhanna:/Users/Shared/webapp/twit_env/twit » ../bin/pserve development.ini | |
load_ini | |
ini_path: /Users/Shared/webapp/twit_env/twit/development.ini | |
load_ini | |
ini_path: /Users/Shared/webapp/twit_env/twit/development.ini | |
2014-05-25 19:43:19,024 INFO [pika.adapters.base_connection][MainThread] Connecting to 0.0.0.0:5672 | |
Starting server in PID 3655. | |
serving on http://0.0.0.0:6543 | |
got here if | |
got here append | |
got here incr 1 | |
got here basic_ack | |
got here if | |
got here append | |
got here incr 2 | |
got here basic_ack | |
got here if | |
got here append | |
got here incr 3 | |
got here basic_ack | |
^C^CExiting (-v to see traceback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment