Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #30708 [Messenger] ReceiverInterface::handle() to get() & Wor…
…ker with prioritized transports (weaverryan) This PR was squashed before being merged into the 4.3-dev branch (closes #30708). Discussion ---------- [Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | Helps with #30699 | License | MIT | Doc PR | TODO Highlights: * `messenger:consume` can now consume messages from multiple transports with priority ❗️ ``` bin/console messenger:consume amqp_high amqp_medium amqp_low ``` * How long you want to sleep before checking more messages is now an option to `messenger:consume` * `ReceiverInterface::receive()` is replaced with `ReceiverInterface::get()` * Logic for looping & sleeping is moved into `Worker` Commits ------- e800bd5 [Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports
- Loading branch information
Showing
28 changed files
with
917 additions
and
804 deletions.
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
48 changes: 0 additions & 48 deletions
48
src/Symfony/Component/Messenger/Tests/Fixtures/CallbackReceiver.php
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
src/Symfony/Component/Messenger/Tests/Fixtures/DummyWorker.php
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,46 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Messenger\Tests\Fixtures; | ||
|
||
use Symfony\Component\Messenger\WorkerInterface; | ||
|
||
class DummyWorker implements WorkerInterface | ||
{ | ||
private $isStopped = false; | ||
private $envelopesToReceive; | ||
private $envelopesHandled = 0; | ||
|
||
public function __construct(array $envelopesToReceive) | ||
{ | ||
$this->envelopesToReceive = $envelopesToReceive; | ||
} | ||
|
||
public function run(array $options = [], callable $onHandledCallback = null): void | ||
{ | ||
foreach ($this->envelopesToReceive as $envelope) { | ||
if (true === $this->isStopped) { | ||
break; | ||
} | ||
|
||
if ($onHandledCallback) { | ||
$onHandledCallback($envelope); | ||
++$this->envelopesHandled; | ||
} | ||
} | ||
} | ||
|
||
public function stop(): void | ||
{ | ||
$this->isStopped = true; | ||
} | ||
|
||
public function isStopped(): bool | ||
{ | ||
return $this->isStopped; | ||
} | ||
|
||
public function countEnvelopesHandled() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
{ | ||
return $this->envelopesHandled; | ||
} | ||
} |
Oops, something went wrong.
: int