Go to file
2026-02-23 10:57:55 +04:00
.gitignore Initial Go rabbit worker 2026-02-23 09:22:09 +04:00
Dockerfile Minimal HTTP-only worker 2026-02-23 10:30:01 +04:00
go.mod Add Rabbit/Postgres worker with health endpoint 2026-02-23 10:57:55 +04:00
go.sum Add Rabbit/Postgres worker with health endpoint 2026-02-23 10:57:55 +04:00
main.go Add Rabbit/Postgres worker with health endpoint 2026-02-23 10:57:55 +04:00
README.md Initial Go rabbit worker 2026-02-23 09:22:09 +04:00

Rabbit Worker (Go)

Consumes CRUD messages from RabbitMQ and writes to Postgres.

Environment variables

RabbitMQ:

  • AMQP_URL (preferred), example: amqp://user:pass@host:5672/vhost
  • or RABBIT_HOST, RABBIT_PORT (default 5672), RABBIT_USER, RABBIT_PASSWORD, RABBIT_VHOST (default /)
  • RABBIT_QUEUES (comma-separated, default crud_queue)
  • RABBIT_DURABLE (default true)
  • RABBIT_PREFETCH (default 1)
  • REQUEUE_ON_ERROR (default true)

Postgres:

  • DATABASE_URL (preferred)
  • or PGHOST, PGPORT (default 5432), PGUSER, PGPASSWORD, PGDATABASE (default postgres), PGSSLMODE (default require)
  • PG_TABLE (default nubes_test_table)

Message format

JSON payload:

{"action":"create","text":"hello","id":1}

Fields:

  • action: create | update | delete
  • id: required for update and delete
  • text: used by create and update

If the payload is not JSON, it is treated as create with body as text.

Build

cd /home/naeel/terraform/PROD_STAND/RABBIT/rabbit-worker

docker build -t <registry>/<image>:<tag> .