Creating a RabbitMQ Producer for the Houses App

Learn how to create a RabbitMQ producer in Django.

Creating a producer in the Houses app

In RabbitMQ, the word producer refers to any application or program that sends messages. Therefore, producing means sending.

To create a RabbitMQ producer in the Houses app, we'll create a file in the houses app folder named producer.py. We'll use Pika, a Python implementation of the AMQP 0-9-1 protocol for RabbitMQ, to connect our web application to RabbitMQ.

Then, we'll open the file and import pika and json, like so:

Get hands-on with 1200+ tech skills courses.