# README
Go RabbitMQ Auto-Reconnect Project
This project demonstrates a simple implementation of a RabbitMQ consumer and producer in Go with automatic reconnection capabilities.
Explores the hypothesis of using a single connection for many channels, both for producers and consumers, in a RabbitMQ setup. This architectural choice aims to optimize resource usage and improve performance in scenarios with a large number of channels.
Requirements
- go 1.21
Installation
- use the module:
go get github.com/afaf-tech/go-rabbitmq
Consumer
# How to use the consumer
Producer
# How to use the producer
Backlog
- Proper Logging
- Producer function
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
# Functions
NewConnection creates a new Connection object and initializes it with the provided configuration.
NewConsumer initializes a new Consumer instance and declares the queue with the specified options.
NewProducer initializes a new Producer instance and declares the queue with the specified options.
# Structs
Config holds the configuration options for establishing a RabbitMQ connection and managing consumer channels.
Connection wraps the actual AMQP connection and provides reconnection logic, ensuring that the connection and channels remain active or are re-established when necessary.
Consumer represents an AMQP consumer that consumes messages from a RabbitMQ queue.
Message represents a message received by a consumer from a RabbitMQ queue.
Producer represents an AMQP producer that sends messages to a specified RabbitMQ queue.
PublishOptions represents the configuration options for publishing a message to RabbitMQ.
QueueOptions represents the configuration options for declaring a queue in RabbitMQ.