Configuring Queues for Webhooks

Configuring Queues for Webhooks

ElmapiCMS uses a queue system to send webhooks asynchronously. This ensures that actions within the CMS (like creating or updating content) are fast, while the webhook is sent reliably in the background.

For webhooks to function, you must configure a queue driver and run a queue worker.

Choosing a Queue Driver

You can set your queue driver in the .env file using the QUEUE_CONNECTION variable.

QUEUE_CONNECTION=database

Here are the most common options and how they work:

sync (Default for Local)

  • How it works: This is not a real queue. It runs tasks immediately and in the foreground.
  • Pros: Simple, no setup required, great for local development or debugging.
  • Cons: Not suitable for production. It can slow down HTTP requests because the webhook isn't sent in the background. If the webhook fails, it won't be retried.
  • Worker Required: No.
  • How it works: Jobs are stored in a database table. A queue worker process polls this table and executes pending jobs.
  • Pros: Easy to set up on most hosting environments (including shared hosting), reliable, and includes retry logic for failed jobs.
  • Cons: Can be slightly slower than in-memory queues like Redis.
  • Worker Required: Yes. You must have a process running php artisan queue:work.

redis (Advanced)

  • How it works: Jobs are pushed to a Redis server, which is an extremely fast in-memory database.
  • Pros: Very high performance, ideal for applications with a large volume of jobs.
  • Cons: Requires a Redis server to be installed and configured, which may not be available on all hosting plans.
  • Worker Required: Yes. You must have a process running php artisan queue:work.

Setting Up the Queue Worker

The method for setting up the queue worker depends on your hosting environment. Please refer to your specific deployment guide for instructions:

Search documentation

Find guides and reference pages