-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning to show that a sync queue is in use
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Torr\TaskManager\Receiver; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; | ||
use Symfony\Component\Messenger\Transport\Sync\SyncTransport; | ||
use Symfony\Component\Messenger\Transport\TransportInterface; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class ReceiverHelper | ||
{ | ||
/** | ||
*/ | ||
public function __construct ( | ||
/** @var iterable<TransportInterface> */ | ||
#[TaggedIterator("messenger.receiver")] | ||
private readonly iterable $transports, | ||
) {} | ||
|
||
/** | ||
* Returns whether the app uses sync transports | ||
*/ | ||
public function hasSyncTransport () : bool | ||
{ | ||
foreach ($this->transports as $transport) | ||
{ | ||
if ($transport instanceof SyncTransport) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |