Skip to content

messaging

Benjamin Bennett edited this page Dec 13, 2020 · 15 revisions

This is a simple implementation of message publishing using RabbitMQ and a Go RabbitMQ Client Library.

cd go-bits/messaging
docker-compose up
go run -race main.go
  1. A connection manager is created and handles:
    • Initial connection to RabbitMQ and automated re-connection if the connection is closed.
    • Obtaining a server channel (not to be confused with a go channel).
  2. Connection to RabbitMQ is initiated.
  3. A queue is configured.
  4. A message publisher is created.
  5. Loop is used to publish messages.

Configuration for the connection manager is passed to NewConnManager and used to set the address for RabbitMQ, the retry interval and the maximum number of retry attempts.

Clone this wiki locally