-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate event publishing command bus
- Loading branch information
Showing
5 changed files
with
96 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
|
||
namespace SimplyCodedSoftware\DomainModel; | ||
|
||
use SimplyCodedSoftware\Messaging\Annotation\MessageEndpoint; | ||
use SimplyCodedSoftware\DomainModel\LazyEventBus\LazyEventPublishing; | ||
use SimplyCodedSoftware\Messaging\Annotation\Gateway; | ||
use SimplyCodedSoftware\Messaging\Annotation\Parameter\Header; | ||
use SimplyCodedSoftware\Messaging\Annotation\Parameter\Headers; | ||
use SimplyCodedSoftware\Messaging\Annotation\Parameter\Payload; | ||
use SimplyCodedSoftware\Messaging\MessageHeaders; | ||
|
||
/** | ||
* Interface CommandBusWithEventPublishing | ||
* @package SimplyCodedSoftware\DomainModel | ||
* @author Dariusz Gafka <[email protected]> | ||
* @MessageEndpoint() | ||
*/ | ||
interface CommandBusWithEventPublishing extends CommandBus | ||
{ | ||
/** | ||
* Entrypoint for commands, when you access to instance of the command | ||
* | ||
* @param object $command instance of command | ||
* | ||
* @return mixed | ||
* | ||
* @Gateway(requestChannel=CommandBus::CHANNEL_NAME_BY_OBJECT) | ||
* @LazyEventPublishing() | ||
*/ | ||
public function send($command); | ||
|
||
/** | ||
* Entrypoint for commands, when you access to instance of the command | ||
* | ||
* @param object $command instance of command | ||
* @param array $metadata | ||
* | ||
* @return mixed | ||
* | ||
* @Gateway( | ||
* requestChannel=CommandBus::CHANNEL_NAME_BY_OBJECT, | ||
* parameterConverters={ | ||
* @Payload(parameterName="command"), | ||
* @Headers(parameterName="metadata") | ||
* } | ||
* ) | ||
* @LazyEventPublishing() | ||
*/ | ||
public function sendWithMetadata($command, array $metadata); | ||
|
||
/** | ||
* @param string $name | ||
* @param string $dataMediaType | ||
* @param mixed $commandData | ||
* | ||
* @return mixed | ||
* @Gateway( | ||
* requestChannel=CommandBus::CHANNEL_NAME_BY_NAME, | ||
* parameterConverters={ | ||
* @Header(parameterName="name", headerName=CommandBus::CHANNEL_NAME_BY_NAME), | ||
* @Header(parameterName="dataMediaType", headerName=MessageHeaders::CONTENT_TYPE), | ||
* @Payload(parameterName="commandData") | ||
* } | ||
* ) | ||
* @LazyEventPublishing() | ||
*/ | ||
public function convertAndSend(string $name, string $dataMediaType, $commandData); | ||
|
||
/** | ||
* @param string $name | ||
* @param string $dataMediaType | ||
* @param mixed $commandData | ||
* @param array $metadata | ||
* | ||
* @return mixed | ||
* | ||
* @Gateway( | ||
* requestChannel=CommandBus::CHANNEL_NAME_BY_NAME, | ||
* parameterConverters={ | ||
* @Headers(parameterName="metadata"), | ||
* @Header(parameterName="name", headerName=CommandBus::CHANNEL_NAME_BY_NAME), | ||
* @Header(parameterName="dataMediaType", headerName=MessageHeaders::CONTENT_TYPE), | ||
* @Payload(parameterName="commandData") | ||
* } | ||
* ) | ||
* @LazyEventPublishing() | ||
*/ | ||
public function convertAndSendWithMetadata(string $name, string $dataMediaType, $commandData, array $metadata); | ||
} |
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