-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace queue factory with queue providers #222
Merged
Merged
Changes from 16 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
fdbf137
Remove `@internal` from `QueueInterface`
vjik a268694
queue provider
vjik fed6a1c
improve
vjik c8953c4
`QueueProviderInterfaceProxy`
vjik 372aeca
remove exceptions
vjik 3634ab1
config
vjik 7384ad0
Remove factory
vjik fe55578
fix tests
vjik 47c6940
test `PrototypeQueueProvider`
vjik 48ad3af
test `FactoryQueueProvider`
vjik 0fb0d45
test `CompositeQueueProvider`
vjik bfd3445
Apply fixes from StyleCI
StyleCIBot 97689da
Improve `QueueFactoryQueueProvider`
vjik 9bbe358
Add `AdapterFactoryQueueProvider`
vjik 4b25f4b
improve tests
vjik 06a3fb8
Merge remote-tracking branch 'origin/queue-factory' into queue-factory
vjik 8f593d9
Rename "channel-definitions" to "channels"
vjik 394c50f
stubs phpdoc
vjik 7a8601c
phpdoc
vjik f90b3df
Apply fixes from StyleCI
StyleCIBot cf9dd96
readme
vjik 45fd659
Merge remote-tracking branch 'origin/queue-factory' into queue-factory
vjik 03b742d
fix cs
vjik 5cd929b
Update src/Command/ListenAllCommand.php
vjik 00ee57d
Move `DEFAULT_CHANNEL_NAME` to `QueueInterface`
vjik addfd5e
Merge remote-tracking branch 'origin/queue-factory' into queue-factory
vjik 80cc195
Apply fixes from StyleCI
StyleCIBot 808bc5a
Extract stubs to separate namespace
vjik 341f15e
Merge remote-tracking branch 'origin/queue-factory' into queue-factory
vjik 0354ea8
Merge branch 'master' into queue-factory
vjik 305d64f
Fix `Queue`
vjik 136b584
fix exception
vjik dc95ac7
fix
vjik 3699e6f
Merge branch 'master' into queue-factory
vjik 94d8540
Remove QueueFactoryQueueProvider
viktorprogger 14401e1
Fix docs
viktorprogger 1cc4438
Fix config
viktorprogger f982680
Bugfixes
viktorprogger 88370f9
Apply fixes from StyleCI
StyleCIBot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Queue\Adapter; | ||
|
||
use Yiisoft\Queue\Enum\JobStatus; | ||
use Yiisoft\Queue\Message\MessageInterface; | ||
|
||
final class StubAdapter implements AdapterInterface | ||
{ | ||
public function runExisting(callable $handlerCallback): void | ||
{ | ||
} | ||
|
||
public function status(int|string $id): JobStatus | ||
{ | ||
return JobStatus::done(); | ||
} | ||
|
||
public function push(MessageInterface $message): MessageInterface | ||
{ | ||
return $message; | ||
} | ||
|
||
public function subscribe(callable $handlerCallback): void | ||
{ | ||
} | ||
|
||
public function withChannel(string $channel): AdapterInterface | ||
{ | ||
return clone $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Queue\Cli; | ||
|
||
final class StubLoop implements LoopInterface | ||
{ | ||
public function __construct( | ||
private readonly bool $canContinue = true, | ||
) { | ||
} | ||
|
||
public function canContinue(): bool | ||
{ | ||
return $this->canContinue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Queue\Debug; | ||
|
||
use Yiisoft\Queue\Provider\QueueProviderInterface; | ||
use Yiisoft\Queue\QueueInterface; | ||
|
||
final class QueueProviderInterfaceProxy implements QueueProviderInterface | ||
{ | ||
public function __construct( | ||
private readonly QueueProviderInterface $queueProvider, | ||
private readonly QueueCollector $collector, | ||
) { | ||
} | ||
|
||
public function get(string $channel): QueueInterface | ||
{ | ||
$queue = $this->queueProvider->get($channel); | ||
return new QueueDecorator($queue, $this->collector); | ||
} | ||
|
||
public function has(string $channel): bool | ||
{ | ||
return $this->queueProvider->has($channel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add definitions for all the providers, so if users want to use one of them, they can do it easily with just setting a definition for the provider interface.
AdapterFactoryQueueProvider::class => [...], QueueFactoryQueueProvider::class => [...], // and set the default one QueueProviderInterface::class => AdapterFactoryQueueProvider::class,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the configuration is as it was before. I want to improve package configuration in one of the next PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no guarantee those future PRs will be merged into
master
soon. Those who already use this package should have a convenient configuration now. Let's do it before the PR is merged.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently package in dev status. It's OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a not released package I'm for making a breaking change, but I'm against lack of configuration. I have two arguments for this: