Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
->tag('messenger.transport_factory')

->set('messenger.transport.in_memory.factory', InMemoryTransportFactory::class)
->args([
service('clock')->nullOnInvalid(),
])
->tag('messenger.transport_factory')
->tag('kernel.reset', ['method' => 'reset'])

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Messenger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.1
---

* `InMemoryTransportFactory` creates the `InMemoryTransport` with a clock (if configured in the factory)
* Add option `redis_sentinel` as an alias for `sentinel_master`
* Add `--all` option to the `messenger:consume` command
* Add parameter `$jitter` to `MultiplierRetryStrategy` in order to randomize delay and prevent the thundering herd effect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Messenger\Transport\InMemory;

use Psr\Clock\ClockInterface;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
use Symfony\Component\Messenger\Transport\TransportInterface;
Expand All @@ -28,11 +29,16 @@ class InMemoryTransportFactory implements TransportFactoryInterface, ResetInterf
*/
private array $createdTransports = [];

public function __construct(
private readonly ?ClockInterface $clock = null,
) {
}

public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
['serialize' => $serialize] = $this->parseDsn($dsn);

return $this->createdTransports[] = new InMemoryTransport($serialize ? $serializer : null);
return $this->createdTransports[] = new InMemoryTransport($serialize ? $serializer : null, $this->clock);
}

public function supports(string $dsn, array $options): bool
Expand Down