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
3 changes: 1 addition & 2 deletions config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Yiisoft\Queue\Debug\QueueProviderInterfaceProxy;
use Yiisoft\Queue\Debug\QueueWorkerInterfaceProxy;
use Yiisoft\Queue\Provider\QueueProviderInterface;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\Worker\WorkerInterface;

return [
Expand All @@ -24,7 +23,7 @@
'yiisoft/queue' => [
'handlers' => [],
'channels' => [
QueueInterface::DEFAULT_CHANNEL => AdapterInterface::class,
QueueProviderInterface::DEFAULT_CHANNEL => AdapterInterface::class,
],
'middlewares-push' => [],
'middlewares-consume' => [],
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/SynchronousAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Yiisoft\Queue\ChannelNormalizer;
use Yiisoft\Queue\JobStatus;
use Yiisoft\Queue\Message\MessageInterface;
use Yiisoft\Queue\Provider\QueueProviderInterface;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\Worker\WorkerInterface;
use Yiisoft\Queue\Message\IdEnvelope;
Expand All @@ -22,7 +23,7 @@ final class SynchronousAdapter implements AdapterInterface
public function __construct(
private readonly WorkerInterface $worker,
private readonly QueueInterface $queue,
string|BackedEnum $channel = QueueInterface::DEFAULT_CHANNEL,
string|BackedEnum $channel = QueueProviderInterface::DEFAULT_CHANNEL,
) {
$this->channel = ChannelNormalizer::normalize($channel);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Command/ListenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Yiisoft\Queue\Provider\QueueProviderInterface;
use Yiisoft\Queue\QueueInterface;

#[AsCommand(
'queue:listen',
Expand All @@ -30,7 +29,7 @@ public function configure(): void
'channel',
InputArgument::OPTIONAL,
'Queue channel name to connect to',
QueueInterface::DEFAULT_CHANNEL,
QueueProviderInterface::DEFAULT_CHANNEL,
);
}

Expand Down
3 changes: 3 additions & 0 deletions src/Provider/QueueProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
*/
interface QueueProviderInterface
{
/** @psalm-suppress MissingClassConstType */
public const DEFAULT_CHANNEL = 'yii-queue';

/**
* Find a queue by channel name and returns it.
*
Expand Down
3 changes: 0 additions & 3 deletions src/QueueInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

interface QueueInterface
{
/** @psalm-suppress MissingClassConstType */
public const DEFAULT_CHANNEL = 'yii-queue';

/**
* Pushes a message into the queue.
*
Expand Down
4 changes: 2 additions & 2 deletions stubs/StubAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Yiisoft\Queue\ChannelNormalizer;
use Yiisoft\Queue\JobStatus;
use Yiisoft\Queue\Message\MessageInterface;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\Provider\QueueProviderInterface;

/**
* Stub adapter that does nothing. Job status is always "done".
Expand All @@ -19,7 +19,7 @@ final class StubAdapter implements AdapterInterface
private string $channel;

public function __construct(
string|BackedEnum $channel = QueueInterface::DEFAULT_CHANNEL
string|BackedEnum $channel = QueueProviderInterface::DEFAULT_CHANNEL
) {
$this->channel = ChannelNormalizer::normalize($channel);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Adapter/SynchronousAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Queue\JobStatus;
use Yiisoft\Queue\Message\IdEnvelope;
use Yiisoft\Queue\Message\Message;
use Yiisoft\Queue\QueueInterface;
use Yiisoft\Queue\Provider\QueueProviderInterface;
use Yiisoft\Queue\Stubs\StubQueue;
use Yiisoft\Queue\Stubs\StubWorker;
use Yiisoft\Queue\Tests\TestCase;
Expand Down Expand Up @@ -58,7 +58,7 @@ public function testIdSetting(): void
public function testWithSameChannel(): void
{
$adapter = $this->getAdapter();
self::assertEquals($adapter, $adapter->withChannel(QueueInterface::DEFAULT_CHANNEL));
self::assertEquals($adapter, $adapter->withChannel(QueueProviderInterface::DEFAULT_CHANNEL));
}

public function testWithAnotherChannel(): void
Expand Down
Loading