-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes ReceiverInterface::handle() to get() to give more control to …
…Worker
- Loading branch information
1 parent
76260e7
commit 357cdb9
Showing
25 changed files
with
609 additions
and
651 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
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(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() | ||
{ | ||
return $this->envelopesHandled; | ||
} | ||
} |
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
Oops, something went wrong.