All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
once
calls with no message handled will have an{queueName} empty-receive
span name.
- Fixed the open telemetry
_register.php
file autoload
- Added open telemetry instrumentation around
Consumer::once
andDriver::enqueue
. These respect messaging span semantic conventions.
See the upgrade guide for more information.
- PHP 8.0+ is required
- Various interfaces have tightened return types
- Support PHP
^7.4 || ^8.0
- Dropped support for PHP 7.3
- PHP 7.3+ is required.
- Implementing
PMG\Queue\Message
is no longer required! Messages passed to the the producer and handled by the consumer can be any PHP object now. In the cases where a plain object is used, the message name is the full qualified class name. However, you may implementMessage
should you desire to keep the old behavior of having a specific message name that differs from the FQCN. PMG\Queue\Router::queueFor
now typehints againstobject
instead ofMessage
.- All
PMG\Queue\MessageLifecycle
methods now typehint againstobject
. PMG\Queue\Envelope
andDefaultEnvelope
now deal withobject
messages only and do not typehint againMessage
.PMG\Queue\Driver::enqueue
now typehints againsobject
instead of message. if a driver gets anEnvelope
instance it should use that instead of creating its own envelope. SeeUPGRADE-5.0.md
for more details.PMG\Queue\MessageHandler::handle
now typehints againstobject
instead ofMessage
.PMG\Queue\Producer::send
now typehints againstobject
instead ofMessage
.MessageLifecycle::failed
no longer has an$isRetrying
argument, insteadMessageLifecycyle::retrying
will be called instead.PMG\Queue\Router::queueFor
now has a?string
return type.- Drivers should no longer call
Envelope::retry
instead, instead consumers should call this method along with any delay required from theRetrySpec
. SeeUPGRADE-5.0.md
for more details.
n/a
- A new
MessageLifecycle::retrying
method was added that gets called whenever a message fails and is retrying. PMG\Queue\Lifecycle\DelegatingLifecycle
has a new named constructor:fromIterable
. This uses PHP 7.1'siterable
pseudo type.RetrySpec::retryDelay
method added to allow a message to be delayed when retrying, if the driver supports it.Envelope::retry
now accepts anint $delay
to support delayed retries. Not all drivers will be able to support delaying.- Similarly,
PMG\Queue\Driver
implementations must no longer callEnvelope::retry
as they were required to do previously. SeeUPGRADE-5.0.md
for more details. InsteadPMG\Queue\Consumer
implementations should callEnvelope::retry
.
PMG\Queue\NullLifecycle
was removed (deprecated in version 4.2), usePMG\Queue\Lifecycle\NullLifecycle
instead.PMG\Queue\Exception\MessageFailed
was removed (it was unused in the core).
PMG\Queue\Lifecycle\DelegatingLifecycle::fromArray
. UsefromIterable
instead.- The
PMG\Queue\MessageTrait
has been deprecated. The behavior it provided (using the fully qualified class name as the message name) is now the default.
- Deprecated
PMG\Queue\NullLifecycle
, usePMG\Queue\Lifecycle\NullLifecycle
instead.
- Two new
PMG\Queue\MessageLifecycle
implementations:PMG\Queue\Lifecycle\DelegatingLifecycle
to delegate to one or more other message lifecyclesPMG\Queue\Lifecycle\MappingLifecycle
to delegate to other message lifecycles based on the message name.
PMG\Queue\Handler\Pcntl
was moved toPMG\Queue\Handler\Pcntl\Pcntl
Pcntl::wait
now returns a result object that provides the successful exit result as well as an exit code.
- Fixed a typo in
DefaultConsumer
causing undefined method errors. See #66
- [BC Break] Dropped support for PHP 5.6
- [BC Break]
NativeSerializer
now uses aPMG\Queue\Signer\Signer
to sign its message. Previously this was all handled by the serializer directly. SeeUPGRADE-4.0.md
for a migration path. - [BC Break, Internals]
AbstractPersistanceDriver::assureSerializer
was renamed toensureSerializer
. - [BC Break, Internals]
Driver
now has more strict type declarations. - [BC Break, Internals]
Driver::release
was introduced. - [BC Break, Internals]
Consumer::once
andConsumer::run
Now take an optionalMessageLifecycle
instance as their second argument. Only folks who wrote custom consumer implementations need to worry about this. SeeDefaultConsumer
for an example how this may be handled. End users can keep using the consumer exactly as they were. - [BC Break, Internals]
MessageHandler::handle
now returns a promise object from theguzzlehttp/promises
library. Only folks who wrote custom handler implementations need to worry about this. RetrySpec::canRetry
now has a return type hint.Consumer::once
andConsumer::run
havestring
typehints for their$queueName
arguments.Consumer::stop
now has a typehint for its$code
argument.
n/a
- A new
PMG\Queue\Signer\Signer
interface was added as a way to make the message signature generation and validation pluggable inSerializer
implementations. PMG\Queue\MessageLifecycle
was introduced as a way for you to hook into a consumer as it moves a message through its life.
n/a
- PcntlForkingHandler now always exits, which prevents child processes from turning into extra consumers and forking child processes themselves. See #47
- Child processes that exit abnormaly in
PcntlForkingHandler
now throw anAbnormalExit
exception with some info about what went wrong. Practically this has no impact: the job is still failed and (possibly) retried, but the thrown exception will be logged and hopefully give users a better place to start debugging.
PcntlForkingHandler
now throws aCouldNotFork
exception that causes the consumer to exit unsuccessfully. Since a failure to fork is clearly on level with a driver error -- a system issue, not an application issue -- this is more in line with what should happen. The consumer will exit and its process manager can restart it.
n/a
- There is a new
PMG\Queue\Handler\Pcntl
class that acts as a thin wrapper around thepcntl_*
functions andexit
. Mostly done for testing purposes.
- [BC BREAK] PHP version requirement was bumped to 5.6
- [BC BREAK]
DefaultConsumer::once
(and theConsumer
interface) have been changed to makeonce
safe to run in a loop. In other words, it never throws exceptions unless it's a must stop or an exception thrown from a driver. All other exceptions are logged, but not fatal. The idea here is to make consumers safe to decorate without having to duplicate the error handling logic. - [BC BREAK]
PMG\Queue\Serializer\SigningSerializer
has been merged intoNativeSerializer
and removed. Pass your key as the first argument toNativeSerializer
's constructor. - [BC BREAK]
AbstractPersistanceDriver::getSerializer
was removed, useAbstractPersistanceDriver::assureSerializer
instead. - [BC BREAK]
Consumer::stop
now takes an optional exit code. Only really relevant for implementors or theConsumer
interface. - [BC BREAK]
MessageExecutor
,HandlerResolver
, and their implementations have been removed. SeeUPGRADE-3.0.md
for some info on migration. Consumer
has docblocks that reflect its actual return values now.PheanstalkDriver
is no longer part of the core. Instead of requiringpmg/queue
directly in yourcomposer.json
, requirepmg/queue-pheanstalk
(or any other driver implementation).DefaultConsumer
is no longer final, and its private methods are now protected.
DefaultConsumer
now catches and handles PHP 7'sError
exceptions
- An
AbstractConsumer
class that provides therun
andstop
methods for consumers without tying them to a specific implementation ofonce
.
This will be the last release in the 2.X series.
BC Breaks:
- None
Bug Fixes:
SigningSerializer
now useshash_equals
instead of strict equality. PHP 5.5 users will fallback on the Symfony 5.6 polyfill.
New Features:
- Support for
allowed_classes
in PHP 7'sunserialize
function forNativeSerializer
Simple license update.
BC Breaks:
- None
Bug Fixes:
- None
BC Breaks:
- None
Bug Fixes:
SerializationError
is now treated as aDriverError
since that's where those errors originate.
BC Breaks:
- everything, completely refactored
New Features:
- Multi queue support baked in
- Allow single and forking message execution
- Remove job options and shift them into drivers