pika-upfluence 0.10.3

Introduction

Pika is a pure-Python implementation of the AMQP 0-9-1 protocol including RabbitMQ’s
extensions.

Python 2.6+ and 3.3+ are supported.

Since threads aren’t appropriate to every situation, it doesn’t
require threads. It takes care not to forbid them, either. The same
goes for greenlets, callbacks, continuations and generators. It is
not necessarily thread-safe however, and your mileage will vary.

People may be using direct sockets, plain old select(),
or any of the wide variety of ways of getting network events to and from a
python application. Pika tries to stay compatible with all of these, and to
make adapting it to a new environment as simple as possible.

importpikaconnection=pika.BlockingConnection()channel=connection.channel()formethod_frame,properties,bodyinchannel.consume('test'):# Display the message parts and ack the messageprint(method_frame,properties,body)channel.basic_ack(method_frame.delivery_tag)# Escape out of the loop after 10 messagesifmethod_frame.delivery_tag==10:break# Cancel the consumer and return any pending messagesrequeued_messages=channel.cancel()print('Requeued %i messages'%requeued_messages)connection.close()

Pika provides the following adapters

BlockingConnection - enables blocking, synchronous operation on top of library for simple uses