Recompile
This commit is contained in:
parent
1636942b5d
commit
b92e41c751
@ -201,6 +201,7 @@ channel.basic_publish(exchange='logs',
|
||||
body=message)
|
||||
print " [x] Sent %r" % (message,)</code></pre></div>
|
||||
|
||||
[(full emit_log.py source)](http://github.com/rabbitmq/rabbitmq-tutorials/blob/master/python/emit_log.py)
|
||||
|
||||
As you see, we avoided declaring exchange. If the `logs` exchange
|
||||
isn't created at the time this code is executed the message will be
|
||||
@ -236,6 +237,7 @@ channel.basic_consume(callback,
|
||||
|
||||
pika.asyncore_loop()</code></pre></div>
|
||||
|
||||
[(full receive_logs.py source)](http://github.com/rabbitmq/rabbitmq-tutorials/blob/master/python/receive_logs.py)
|
||||
|
||||
|
||||
We're done. If you want to save logs to a file, just open a console and type:
|
||||
|
@ -148,6 +148,21 @@ Using that code we may be sure that even if you kill a worker using
|
||||
CTRL+C while it was processing a message, it will won't be lost. Soon
|
||||
after the worker dies all unacknowledged messages will be redispatched.
|
||||
|
||||
> #### Forgotten acknowledgment
|
||||
>
|
||||
> It's a pretty common mistake to miss `basic_ack`. It's an easy error,
|
||||
> but the consequences are serious. Messages will be redelivered
|
||||
> when your client quits (which may look like random redelivery),
|
||||
> Rabbit will eat more and more memory as it won't be able to release
|
||||
> any unacked messages.
|
||||
>
|
||||
> In order to debug this kind of mistakes you may use `rabbitmqctl`
|
||||
> to print `messages_unacknowledged` field:
|
||||
>
|
||||
> $ sudo rabbitmqctl list_queues name messages_ready messages_unacknowledged
|
||||
> Listing queues ...
|
||||
> test 0 0
|
||||
> ...done.
|
||||
|
||||
Message durability
|
||||
------------------
|
||||
@ -251,6 +266,8 @@ channel.basic_publish(exchange='', routing_key='test',
|
||||
))
|
||||
print " [x] Sent %r" % (message,)</code></pre></div>
|
||||
|
||||
[(full new_task.py source)](http://github.com/rabbitmq/rabbitmq-tutorials/blob/master/python/new_task.py)
|
||||
|
||||
|
||||
And our worker:
|
||||
|
||||
@ -278,6 +295,7 @@ channel.basic_consume(callback,
|
||||
|
||||
pika.asyncore_loop()</code></pre></div>
|
||||
|
||||
[(full worker.py source)](http://github.com/rabbitmq/rabbitmq-tutorials/blob/master/python/worker.py)
|
||||
|
||||
|
||||
Using message acknowledgments and `prefetch_count` you may set up
|
||||
|
Loading…
Reference in New Issue
Block a user