-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Async processor must be independent classes
- Loading branch information
1 parent
dee8fbc
commit 5385156
Showing
10 changed files
with
60 additions
and
108 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 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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the DataImporter package. | ||
* | ||
* (c) Loïc Sapone <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace IQ2i\DataImporter\Bundle\Processor; | ||
|
||
use IQ2i\DataImporter\Bundle\Messenger\AsyncMessage; | ||
use IQ2i\DataImporter\Exchange\Message; | ||
use IQ2i\DataImporter\Processor\ProcessorInterface; | ||
use Symfony\Component\Messenger\MessageBusInterface; | ||
use Symfony\Contracts\Service\Attribute\Required; | ||
|
||
abstract class AbstractAsyncProcessor implements ProcessorInterface | ||
{ | ||
private ?MessageBusInterface $bus = null; | ||
|
||
public function begin(Message $message) | ||
{ | ||
} | ||
|
||
public function item(Message $message) | ||
{ | ||
$this->bus->dispatch(new AsyncMessage($message)); | ||
} | ||
|
||
abstract public function processItem(AsyncMessage $message); | ||
|
||
public function end(Message $message) | ||
{ | ||
} | ||
|
||
#[Required] | ||
public function setBus(MessageBusInterface $bus): void | ||
{ | ||
$this->bus = $bus; | ||
} | ||
} |
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
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
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