-
Book Overview & Buying
-
Table Of Contents
Mastering RabbitMQ
By :
In order to properly handle the case where a web server that we need to fetch data from goes down, we need to understand one thing. Once a worker fetches a message from RabbitMQ with a no_ack model, which we have been using so far (feel free to reread the code if this is the first time you've seen it), and if it fails, it will take the message with it.
Unless it will only take the message with it once it is really finished working with it. For this to work, we need to use the acknowledgement model from RabbitMQ.
Each worker, once really done with a message, must acknowledge the message back to RabbitMQ, and only then will RabbitMQ sign the message off and remove it from the queue.
Let's update our worker code to acknowledge messages:
#!/usr/bin/env python
importpika
import requests
fromBeautifulSoup import BeautifulSoup
def handler(ch, method, properties, url):
print "-> Starting: [%s]" % (url)
r = requests.get(url)
soup = BeautifulSoup(r.text...
Change the font size
Change margin width
Change background colour