1
0
mirror of synced 2024-11-25 14:36:05 +03:00
symfony-beanstalkd-messenger/Transport/BeanstalkTransportFactory.php

26 lines
789 B
PHP
Raw Normal View History

2021-02-02 11:59:25 +03:00
<?php
namespace RetailCrm\Messenger\Beanstalkd\Transport;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
use Symfony\Component\Messenger\Transport\TransportInterface;
/**
* Class BeanstalkTransportFactory
*
* @package RetailCrm\Messenger\Beanstalkd\Transport
*/
class BeanstalkTransportFactory implements TransportFactoryInterface
{
public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
return new BeanstalkTransport(Connection::fromDsn($dsn, $options), $serializer);
}
public function supports(string $dsn, array $options): bool
{
return 0 === strpos($dsn, 'beanstalkd://');
}
}