Skip to content

About

ueue Dispatcher → Downstream Workflow The PostgreSQL-backed dispatcher retrieves pending emails in controlled batches, marks them for processing, and sends each email as an independent work item to reusable n8n sub-workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

PostgreSQL Email Queue Dispatcher

Summary

The PostgreSQL Email Queue Dispatcher retrieves pending email rows from a PostgreSQL-backed queue table in controlled batches, marks them as claimed for processing, and emits each email as an independent work item (JSON) to be consumed by reusable n8n sub-workflows. The repository contains an exported workflow JSON file named PostgreSQL-Email-Queue-Dispatcher.json that represents the dispatcher logic.

This project automates the step of moving pending email records out of a database queue and into downstream workflow engines for delivery, tracking, or further processing.

How It Works

Input → Processing → Output

  • Input: A PostgreSQL table containing pending email rows (e.g., messages awaiting dispatch).
  • Processing:
    • The dispatcher queries PostgreSQL for pending emails in controlled batch sizes.
    • Each selected row is marked/updated in PostgreSQL to indicate it has been claimed for processing (preventing duplicate workers from picking the same row).
    • For every claimed row, the dispatcher emits a JSON work item representing that email.
  • Output: Individual JSON work items sent to reusable n8n sub-workflows for downstream actions (send email, log, notify, etc.).

Notes:

  • The repository includes the file PostgreSQL-Email-Queue-Dispatcher.json, which contains the exported workflow definition (JSON). That JSON is intended to be imported into a workflow engine such as n8n and configured to access your PostgreSQL instance.
  • The project focuses on the queue-dispatching responsibilities: polling the database, claiming records, and producing per-email work items. Actual delivery or downstream logic is expected to be implemented in the receiving workflows/sub-workflows.

Key Features

  • Retrieves pending email rows from a PostgreSQL queue table in batches.
  • Marks rows as claimed to avoid duplicate processing.
  • Emits each email as an independent JSON work item for downstream workflows.
  • Workflow exported as JSON for import into a workflow engine (file included in the repository).

Tech Stack

  • PostgreSQL — database storing the email queue and status fields.
  • n8n — target workflow engine for downstream sub-workflows (dispatcher emits work items to be processed by n8n workflows).
  • JSON — exported workflow format provided in the repository.

Setup Instructions

  1. Inspect the included workflow file PostgreSQL-Email-Queue-Dispatcher.json in the repository root.
  2. Import the JSON into your workflow orchestration environment (for example, into n8n as a workflow import).
  3. Configure access to your PostgreSQL database inside the workflow engine (create or configure PostgreSQL credentials in n8n or your chosen orchestrator). The workflow requires read/update access to the queue table so it can select pending rows and mark them as claimed.
  4. Configure any workflow-specific parameters after import (for example: batch size, query/lock strategy, table/column names) according to your queue schema. These parameters are expected to be editable inside the imported workflow.

Important: This repository does not contain runtime code beyond the exported JSON workflow; you must run the workflow inside a compatible workflow engine and provide appropriate database credentials.

Usage

  • Execution: Run the imported workflow inside your workflow engine. The workflow can be executed manually for testing or scheduled within the engine to poll the database on a cadence appropriate for your needs.
  • Expected result: The dispatcher queries PostgreSQL for pending emails, updates each claimed row to prevent re-processing, and emits a JSON work item per email for downstream sub-workflows.
  • Downstream handling: The emitted work items are intended to be consumed by reusable sub-workflows (in n8n) which implement email sending, logging, retries, or other business logic.

Security Notes

  • Do not commit database credentials, API keys, or other secrets to the repository.
  • Configure credentials using your workflow engine's secure credential storage (for example, n8n credentials) or environment-specific secret management.
  • The repository includes only an exported workflow JSON; ensure any local copies of credentials or exported credential files are excluded from version control.

Limitations

  • The repository contains a workflow export JSON (PostgreSQL-Email-Queue-Dispatcher.json) but no runtime source code, package manifests, or environment variable definitions were detected.
  • No specific table schema, environment variables, or configuration files are included — you must adapt the workflow's queries and claim/update statements to match your database schema.
  • Downstream processing (actual email send, retry logic, bounce handling) is not included and must be implemented in the receiving sub-workflows.

Included Files

  • PostgreSQL-Email-Queue-Dispatcher.json — exported workflow definition (import into n8n or a compatible workflow engine).

If you need help adapting the workflow to your PostgreSQL schema or configuring it inside n8n, provide the table schema and desired batch/claim behavior and the workflow can be adjusted accordingly.

About

ueue Dispatcher → Downstream Workflow The PostgreSQL-backed dispatcher retrieves pending emails in controlled batches, marks them for processing, and sends each email as an independent work item to reusable n8n sub-workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors