Building Robust RabbitMQ Consumers With Python and Kombu: Part 2
Matt Pease
1302

Nice article, one question (I know I could probably just run the code and see but it’s probably worth asking). Will the worker class retain any state between messages?

Example:

In worker have self.msg_counter= 0 in the init and then

self.msg_counter += 1

print(‘Msgs’s read: ’ + str(self.msg_counter))

in the on_message function. Would that print increasing numbers or is the worker destroyed and re-constructed each time a message is received.

It looks to me that it should be robust (unless there is an exception in worker.run() )

Like what you read? Give Rory Meyer a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.