-
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.
Merge pull request #111 from proophsoftware/feature/stop_dispatch_wit…
…h_preprocessor Allow a preprocessor to stop dispatch
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
examples/PrototypingFlavour/Messaging/CommandWithCustomHandler.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,28 @@ | ||
<?php | ||
/** | ||
* This file is part of the proophsoftware/event-machine. | ||
* (c) 2017-2018 prooph software GmbH <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ProophExample\PrototypingFlavour\Messaging; | ||
|
||
use Prooph\EventMachine\EventMachine; | ||
use Prooph\EventMachine\EventMachineDescription; | ||
use Prooph\EventMachine\JsonSchema\JsonSchema; | ||
|
||
final class CommandWithCustomHandler implements EventMachineDescription | ||
{ | ||
public const CMD_DO_NOTHING = 'DoNothing'; | ||
public const NO_OP_HANDLER = 'NoOpHandler'; | ||
|
||
public static function describe(EventMachine $eventMachine): void | ||
{ | ||
$eventMachine->registerCommand(self::CMD_DO_NOTHING, JsonSchema::object(['msg' => JsonSchema::string()])); | ||
$eventMachine->preProcess(self::CMD_DO_NOTHING, self::NO_OP_HANDLER); | ||
} | ||
} |
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