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.
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.
- 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).
- 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.
- Inspect the included workflow file
PostgreSQL-Email-Queue-Dispatcher.jsonin the repository root. - Import the JSON into your workflow orchestration environment (for example, into n8n as a workflow import).
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.