From e2cab9c1350aedfc62f0e2b01ece0aafc9d67dfc Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Fri, 5 Feb 2021 16:21:54 +0300 Subject: [PATCH] fix decoding headers by PhpSerializer, update README --- README.md | 13 +++++++++++-- Transport/BeanstalkSender.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 533f963..d057992 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,18 @@ framework: 'App\Message\MyMessage': async ``` +* add transport factory in `config/services.yml` + +```yaml +services: +# ... + RetailCrm\Messenger\Beanstalkd\Transport\BeanstalkTransportFactory: + tags: [messenger.transport_factory] +``` + ## Allowed transport options -* `queue_name` - tube name in beanstalkd +* `tube_name` - tube name in beanstalkd * `timeout` - timeout for receiving jobs from tube. Default - 0 @@ -42,4 +51,4 @@ framework: * `not_send_if_exists` - do not send a job to the queue only if such a job is already exist. Default - `true` -All options are optional, if `queue_name` not specified will be used default queue `default` +All options are optional, if `tube_name` not specified will be used default queue `default` diff --git a/Transport/BeanstalkSender.php b/Transport/BeanstalkSender.php index 519e1ef..fb0855b 100644 --- a/Transport/BeanstalkSender.php +++ b/Transport/BeanstalkSender.php @@ -48,7 +48,7 @@ class BeanstalkSender implements SenderInterface $delay = $delayStamp->getDelay(); } - $message = $this->connection->serializeJob($encodedMessage['body'], $encodedMessage['headers']); + $message = $this->connection->serializeJob($encodedMessage['body'], $encodedMessage['headers'] ?? []); if ($this->connection->isNotSendIfExists()) { $this->sendIfNotExist($message, $delay);