All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
oncecalls that handle no message will use an{queueName} empty-receivespan name.
- Fixed autoloading for the OpenTelemetry
_register.phpfile.
- Added OpenTelemetry instrumentation around
Consumer::onceandDriver::enqueue. These follow messaging span semantic conventions.
See the upgrade guide for more information.
- PHP 8.0+ is required
- Various interfaces have tightened return types
- Added support for PHP
^7.4 || ^8.0
- Dropped support for PHP 7.3
- PHP 7.3+ is required.
- Implementing
PMG\Queue\Messageis no longer required! Messages passed to the producer and handled by the consumer can now be any PHP object. When a plain object is used, the message name is the fully qualified class name. However, you may implementMessageif you want to keep the old behavior of having a specific message name that differs from the FQCN. PMG\Queue\Router::queueFornow typehints againstobjectinstead ofMessage.- All
PMG\Queue\MessageLifecyclemethods now typehint againstobject. PMG\Queue\EnvelopeandDefaultEnvelopenow deal withobjectmessages only and no longer typehint againstMessage.PMG\Queue\Driver::enqueuenow typehints againstobjectinstead ofMessage. If a driver gets anEnvelopeinstance, it should use that instead of creating its own envelope. SeeUPGRADE-5.0.mdfor more details.PMG\Queue\MessageHandler::handlenow typehints againstobjectinstead ofMessage.PMG\Queue\Producer::sendnow typehints againstobjectinstead ofMessage.MessageLifecycle::failedno longer has an$isRetryingargument. Instead,MessageLifecycle::retryingwill be called.PMG\Queue\Router::queueFornow has a?stringreturn type.- Drivers should no longer call
Envelope::retry. Instead, consumers should call this method along with any delay required from theRetrySpec. SeeUPGRADE-5.0.mdfor more details.
n/a
- A new
MessageLifecycle::retryingmethod was added and is called whenever a message fails and is retrying. PMG\Queue\Lifecycle\DelegatingLifecyclehas a new named constructor:fromIterable. This uses PHP 7.1'siterablepseudo type.- The
RetrySpec::retryDelaymethod was added to allow a message to be delayed when retrying, if the driver supports it. Envelope::retrynow accepts anint $delayto support delayed retries. Not all drivers will support delays.- Similarly,
PMG\Queue\Driverimplementations must no longer callEnvelope::retry. SeeUPGRADE-5.0.mdfor more details. Instead,PMG\Queue\Consumerimplementations should callEnvelope::retry.
PMG\Queue\NullLifecyclewas removed (deprecated in version 4.2), usePMG\Queue\Lifecycle\NullLifecycleinstead.PMG\Queue\Exception\MessageFailedwas removed (it was unused in the core).
PMG\Queue\Lifecycle\DelegatingLifecycle::fromArray. UsefromIterableinstead.- The
PMG\Queue\MessageTraithas 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\NullLifecycleinstead.
- Two new
PMG\Queue\MessageLifecycleimplementations:PMG\Queue\Lifecycle\DelegatingLifecycleto delegate to one or more other message lifecyclesPMG\Queue\Lifecycle\MappingLifecycleto delegate to other message lifecycles based on the message name.
PMG\Queue\Handler\Pcntlwas moved toPMG\Queue\Handler\Pcntl\PcntlPcntl::waitnow returns a result object that provides the successful exit result as well as an exit code.
- Fixed a typo in
DefaultConsumercausing undefined method errors. See #66
- [BC Break] Dropped support for PHP 5.6
- [BC Break]
NativeSerializernow uses aPMG\Queue\Signer\Signerto sign its message. Previously this was all handled by the serializer directly. SeeUPGRADE-4.0.mdfor a migration path. - [BC Break, Internals]
AbstractPersistanceDriver::assureSerializerwas renamed toensureSerializer. - [BC Break, Internals]
Drivernow has more strict type declarations. - [BC Break, Internals]
Driver::releasewas introduced. - [BC Break, Internals]
Consumer::onceandConsumer::runnow take an optionalMessageLifecycleinstance as their second argument. Only people who wrote custom consumer implementations need to worry about this. SeeDefaultConsumerfor an example of how this may be handled. End users can keep using the consumer as before. - [BC Break, Internals]
MessageHandler::handlenow returns a promise object from theguzzlehttp/promiseslibrary. Only people who wrote custom handler implementations need to worry about this. RetrySpec::canRetrynow has a return type hint.Consumer::onceandConsumer::runhavestringtypehints for their$queueNamearguments.Consumer::stopnow has a typehint for its$codeargument.
n/a
- A new
PMG\Queue\Signer\Signerinterface was added as a way to make the message signature generation and validation pluggable inSerializerimplementations. PMG\Queue\MessageLifecyclewas 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 abnormally in
PcntlForkingHandlernow throw anAbnormalExitexception with some information about what went wrong. Practically, this has no impact: the job still fails and may be retried, but the thrown exception will be logged to give users a better place to start debugging.
PcntlForkingHandlernow throws aCouldNotForkexception that causes the consumer to exit unsuccessfully. Since a failure to fork is on the same level as a driver error, a system issue rather than 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\Pcntlclass that acts as a thin wrapper around thepcntl_*functions andexit. This exists mostly for testing purposes.
- [BC BREAK] PHP version requirement was bumped to 5.6
- [BC BREAK]
DefaultConsumer::once(and theConsumerinterface) have been changed to makeoncesafe to run in a loop. In other words, it never throws exceptions unless it is a must-stop exception or an exception thrown from a driver. All other exceptions are logged but are 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\SigningSerializerhas been merged intoNativeSerializerand removed. Pass your key as the first argument toNativeSerializer's constructor. - [BC BREAK]
AbstractPersistanceDriver::getSerializerwas removed, useAbstractPersistanceDriver::assureSerializerinstead. - [BC BREAK]
Consumer::stopnow takes an optional exit code. This is mainly relevant for implementers of theConsumerinterface. - [BC BREAK]
MessageExecutor,HandlerResolver, and their implementations have been removed. SeeUPGRADE-3.0.mdfor some info on migration. Consumerhas docblocks that reflect its actual return values now.PheanstalkDriveris no longer part of the core. Instead of requiringpmg/queuedirectly in yourcomposer.json, requirepmg/queue-pheanstalk(or any other driver implementation).DefaultConsumeris no longer final, and its private methods are now protected.
DefaultConsumernow catches and handles PHP 7'sErrorexceptions
- An
AbstractConsumerclass that provides therunandstopmethods 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:
SigningSerializernow useshash_equalsinstead of strict equality. PHP 5.5 users will fall back to the Symfony 5.6 polyfill.
New Features:
- Support for
allowed_classesin PHP 7'sunserializefunction forNativeSerializer
Simple license update.
BC Breaks:
- None
Bug Fixes:
- None
BC Breaks:
- None
Bug Fixes:
SerializationErroris now treated as aDriverErrorsince that's where those errors originate.
BC Breaks:
- Everything was refactored.
New Features:
- Multi queue support baked in
- Allow single and forking message execution
- Remove job options and shift them into drivers