Skip to content

Workers

Ketan edited this page Mar 23, 2026 · 1 revision

RabbitMQ

Connection

RabbitMQ is connected through a Docker containered setup on port (default: 5672) using two queues. The configuration is in config.yaml file.

Queues

Queue Name Configuration Key Purpose Worker Job Types
Mail Queue rabbitmq.mailqueue Email Dispatch MailingWorker user_verification, password_reset, violation_warning, thanks_contribution, publish_notice, account_deletion, generic_notice
Moderation Queue rabbitmq.moderationqueue Content Moderation ModeratorWorker review_text, image

Queue names are externalized in the configuration system and accessed via Viper.

Mail Job

This is publised to the mail queue.

Type (string): Email template type
To (string): Recipient email address
Data (map[string]interface{}): Template variables

Moderation Job

This is publised to the moderation queue.

AssetID (uuid.UUID): Identifier of the content to moderate
Type (string): Moderation type (review_text or image)

Workers

MailingWorker

Processes email jobs from mail_queue.

The Email System handles all asynchronous email delivery in Compass through a dedicated worker process that consumes jobs from RabbitMQ and dispatches emails via SMTP. This system manages seven distinct email types including user verification, password resets, and content moderation notifications.

ModeratorWorker

Handles content moderation from the moderation_queue.

The Content Moderation Worker automatically reviews user-generated content (text reviews and images) using OpenAI's moderation API. It processes jobs from the RabbitMQ moderation queue, determines content approval status, updates database records, manages image file lifecycle, and triggers email notifications to users.

CleanupWorker

This performs periodic cleanup tasks on the server.

  • Runs hourly using a ticker
  • Deletes unverified user older than an hour along with associated data i.e., images, profiles, etc.
  • Sends account deletion notification before deletion.

Clone this wiki locally