0 follower

Final Class Yiisoft\Queue\Provider\AdapterFactoryQueueProvider

InheritanceYiisoft\Queue\Provider\AdapterFactoryQueueProvider
ImplementsYiisoft\Queue\Provider\QueueProviderInterface

This queue provider creates new queue objects based on adapter definitions.

See also:

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Queue\QueueInterface $baseQueue, array $definitions, \Psr\Container\ContainerInterface|null $container null, boolean $validate true )
$baseQueue Yiisoft\Queue\QueueInterface

Base queue for queues creation.

$definitions array

Adapter definitions indexed by channel names.

$container \Psr\Container\ContainerInterface|null

Container to use for dependencies resolving.

$validate boolean

If definitions should be validated when set.

throws Yiisoft\Queue\Provider\InvalidQueueConfigException

                public function __construct(
    private readonly QueueInterface $baseQueue,
    array $definitions,
    ?ContainerInterface $container = null,
    bool $validate = true,
) {
    try {
        $this->factory = new StrictFactory($definitions, $container, $validate);
    } catch (InvalidConfigException $exception) {
        throw new InvalidQueueConfigException($exception->getMessage(), previous: $exception);
    }
}

            
get() public method

public Yiisoft\Queue\QueueInterface get ( string|\BackedEnum $channel )
$channel string|\BackedEnum

                public function get(string|BackedEnum $channel): QueueInterface
{
    $channel = ChannelNormalizer::normalize($channel);
    $queue = $this->getOrTryToCreate($channel);
    if ($queue === null) {
        throw new ChannelNotFoundException($channel);
    }
    return $queue;
}

            
has() public method

public boolean has ( string|\BackedEnum $channel )
$channel string|\BackedEnum

                public function has(string|BackedEnum $channel): bool
{
    $channel = ChannelNormalizer::normalize($channel);
    return $this->factory->has($channel);
}