-
-
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.
- Loading branch information
Showing
23 changed files
with
1,678 additions
and
807 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Flow\AsyncHandler; | ||
|
||
use Flow\AsyncHandlerInterface; | ||
use Flow\Event; | ||
use Flow\Event\AsyncEvent; | ||
|
||
use function call_user_func_array; | ||
|
||
final class AsyncHandler implements AsyncHandlerInterface | ||
{ | ||
public static function getSubscribedEvents() | ||
{ | ||
return [ | ||
Event::ASYNC => 'async', | ||
]; | ||
} | ||
|
||
/** | ||
* @param AsyncEvent<T> $event | ||
*/ | ||
public function async(AsyncEvent $event): void | ||
Check failure on line 25 in src/AsyncHandler/AsyncHandler.php
|
||
{ | ||
$event->setReturn(call_user_func_array($event->getAsync(), $event->getArgs())); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Flow\AsyncHandler; | ||
|
||
use Flow\AsyncHandlerInterface; | ||
use Symfony\Component\Messenger\Handler\BatchHandlerInterface; | ||
use Symfony\Component\Messenger\Handler\BatchHandlerTrait; | ||
|
||
final class BatchAsyncHandler implements BatchHandlerInterface, AsyncHandlerInterface | ||
{ | ||
use BatchHandlerTrait; | ||
|
||
public function __construct( | ||
?BatchHandlerInterface $batchHandler = null, | ||
) {} | ||
|
||
public function __invoke(object $message): mixed {} | ||
|
||
public static function getSubscribedEvents() {} | ||
Check failure on line 21 in src/AsyncHandler/BatchAsyncHandler.php
|
||
|
||
private function process(array $jobs): void | ||
Check failure on line 23 in src/AsyncHandler/BatchAsyncHandler.php
|
||
{ | ||
$facts = []; | ||
foreach ($jobs as [$message, $ack]) { | ||
$facts[] = $message->getFact(); | ||
$ack->ack($message); | ||
} | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Flow; | ||
|
||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
interface AsyncHandlerInterface extends EventSubscriberInterface {} |
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
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.