Skip to main content

Fiber and RabbitMQ example

Github StackBlitz

  1. Create Docker network:
make docker.network
  1. Run Docker container with RabbitMQ:
make docker.rabbitmq
  1. Wait 2-3 minutes for the RabbitMQ container to be ready to use.
  2. Run Docker container with worker:
make docker.worker
  1. Start Fiber API server (on another console):
make run
  1. Go to 127.0.0.1:3000/send?msg=Hello! and see received message on worker's console, like this:
2021/03/27 16:32:35 Successfully connected to RabbitMQ instance
2021/03/27 16:32:35 [*] - Waiting for messages
2021/03/27 16:32:35 [*] - Run Fiber API server and go to http://127.0.0.1:3000/send?msg=<YOUR TEXT HERE>
2021/03/27 16:33:24 Received message: Hello!
  1. Also, you can see useful RabbitMQ dashboard at localhost:15672:

Screenshot

How it works?

Screenshot