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:

Constants

Hide inherited constants

Constant Value Description Defined By
DEFAULT_CHANNEL 'yii-queue' Yiisoft\Queue\Provider\QueueProviderInterface

Method Details

Hide inherited methods

__construct() public method

public __construct( Yiisoft\Queue\QueueInterface $baseQueue, array $definitions, \Psr\Container\ContainerInterface|null $container null, boolean $validate true ): mixed
$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 get( string|\BackedEnum $channel ): Yiisoft\Queue\QueueInterface
$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 has( string|\BackedEnum $channel ): boolean
$channel string|\BackedEnum

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