This repository contains a simple demonstration of the producer-consumer model using RabbitMQ in Go. It showcases basic operations such as connecting to a RabbitMQ server, declaring queues, and sending/receiving messages.
The codebase includes a basic implementation of a message producer and consumer using RabbitMQ. The producer sends messages to a specified queue, and the consumer retrieves and processes these messages.
Before running this project, ensure you have the following installed:
- Go (version 1.x or higher)
- RabbitMQ server (locally or remotely accessible)
-
Clone the Repository
-
Install Dependencies
- This project uses the
github.com/rabbitmq/amqp091-go
package. Install it using:go get github.com/rabbitmq/amqp091-go
- Start RabbitMQ Server
- Ensure your RabbitMQ server is running and accessible.
- Run the Application
- Run the application using:
go run main.go
- This will start both the producer and consumer.
main.go
: Contains the main logic for setting up the RabbitMQ connection, channels, producer, and consumer.producer
: Responsible for sending messages to the RabbitMQ queue.consumer
: Listens for messages from the queue and processes them.