Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pika ampq pyramid error
#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")
print("count: " + str(count))
print("got here append")
# Acknowledge the message
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
ini_path: /Users/Shared/webapp/twit_env/twit/development.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
Starting server in PID 3655.
serving on
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