diff --git a/README.rst b/README.rst index 6c1d7e20..b00a5b9a 100644 --- a/README.rst +++ b/README.rst @@ -120,19 +120,23 @@ Quick overview media_exchange = Exchange("media", "direct", durable=True) video_queue = Queue("video", exchange=media_exchange, routing_key="video") + def process_media(body, message): + print body + message.ack() + # connections with BrokerConnection("amqp://guest:guest@localhost//") as conn: # produce with conn.Producer(exchange=media_exchange, - serializer="json") as producer: + serializer="json", routing_key="video") as producer: producer.publish({"name": "/tmp/lolcat1.avi", "size": 1301013}) # consume with conn.Consumer(video_queue, callbacks=[process_media]) as consumer: # Process messages and handle events on all channels while True: - connection.drain_events() + conn.drain_events() # Consume from several queues on the same channel: video_queue = Queue("video", exchange=media_exchange, key="video")