Support for PHP 5.6+ was dropped. Stick with 3.X if PHP 5 support is still necessary.
Previously, you could pass a key to NativeSerializer directly. Now a Signer
instance is required. A named constructor is provided if the 3.X behavior is
still desired.
use PMG\Queue\Signer\HmacSha256;
use PMG\Queue\Serializer\NativeSerializer;
// 3.X
$serializer = new NativeSerializer('secretKey');
// 4.X
$serializer = NativeSerializer::fromSigningKey('secretKey');
// $serializer = new NativeSerializer(new HmacSha256('secretKey'));Consumer::once and Consumer::run both take an optional MessageLifecycle
argument. This is a useful way to hook into the consumer as it moves a message
through its lifecycle (starting, completed, succeeded, failed). Users may
implement this themselves, see the consumers documentation
for more info.
Implementing MessageHandler now requires returning a GuzzleHttp\Promise\PromiseInterface
from the handle method. This lets consumers stop much more gracefully.
If your handler does not really need a promise, use FulfilledPromise:
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Promise\PromiseInterface;
use PMG\Queue\MessageHandler;
final class CustomHandler implements MessageHandler
{
public function handle(Message $message, array $options=[]) : PromiseInterface
{
$result = $this->doHandleSomehow($message, $options);
return new FulfilledPromise($result);
}
}Check the Driver interface
for the updated method signatures.
This method should skip the retry system for the given envelope/message and put it back into a ready state immediately.
class SomeDriver implements Driver
{
private function whatever()
{
// 3.X
$this->assureSerializer()->serialize(...);
// 4.X
$this->ensureSerializer()->serialize(...);
}
}Prefer using $this->serialize or $this->unserialize instead of accessing the
serializer directly.