PMG Queue

pmg/queue is a production ready queue framework that powers many internal projects at PMG.

It’s simple and extensible a number of features we’ve found to be the most useful including automatic retries and multi-queue support.

Installation & Examples

You should require the driver library of your choice with composer rather than pmg/queue directly. If you’re planning to use beanstalkd as your backend:

composer require pmg/queue-pheanstalk:~1.0

See the core examples directory on the pheanstalk examples for some code samples on gluing everything together.

READ THIS: Glossary & Core Concepts

  • A message is a serializable object that goes into the queue for later processing.
  • A producer adds messages to the queue backend via a driver and a router.
  • A consumer pulls messages out of the queue via driver and processes them via handlers.
  • A driver is PHP representation of the queue backend. There is an in memory driver included in this library as an example (and for testing), and an implementation of a beanstalkd driver available.
  • A router is used by a producer to look up the correct queue for a message.
  • A message handler is used by the default consumer to actually do the work of processing a message
  • An envelope is used internally to wrap up messages with retry information as well as metadata specific to drivers. Users need not worry about this unless they are implementing their own driver.