Skip to content

master-wayne7/go-rabbit-mq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-rabbit-mq

Simple example showing how to send and receive messages with RabbitMQ using Go and the github.com/rabbitmq/amqp091-go client.

Files in this repo:

Quick overview:

Requirements

  • Go (see go.mod)
  • Docker & Docker Compose

Run locally with Docker Compose

  1. Start RabbitMQ:
docker-compose up -d

See configuration in docker-compose.yml. 2. Wait until RabbitMQ is healthy (healthcheck may take a few seconds):

docker-compose logs -f rabbitmq

Run the receiver (keep this running in one terminal)

go run ./receive

or

go run [receive.go](receive/receive.go)

This runs the code in receive/main and will print received messages.

Run the sender (in another terminal)

go run ./send

or

go run [send.go](send/send.go)

This runs the code in send/main and sends a single message.

Build binaries

go build -o bin/receive ./receive
go build -o bin/send    ./send

Troubleshooting

  • Connection refused: ensure RabbitMQ is running and ports in docker-compose.yml (5672, 15672) are available.
  • Check Docker container status:
docker ps
docker-compose logs rabbitmq

If Go modules are missing dependencies, run:

go mod tidy

See go.mod.

About

Simple example showing how to send and receive messages with RabbitMQ using Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages