-
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 #1 from PcComponentes/feature/remove-amqp-and-new-…
…serialization Use own serialization and use visitor for remove dependencies on SpyM…
- Loading branch information
Showing
4 changed files
with
76 additions
and
11 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
21 changes: 21 additions & 0 deletions
21
src/Serialization/SchemaValidatorAggregateMessageSerializable.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,21 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Pccomponentes\OpenApiMessagingContext\Serialization; | ||
|
||
use Pccomponentes\Ddd\Util\Message\AggregateMessage; | ||
use Pccomponentes\Ddd\Util\Message\Serialization\AggregateMessageSerializable; | ||
|
||
final class SchemaValidatorAggregateMessageSerializable implements AggregateMessageSerializable | ||
{ | ||
public function serialize(AggregateMessage $message) | ||
{ | ||
return \json_encode( | ||
[ | ||
'message_id' => $message->messageId(), | ||
'type' => $message::messageName(), | ||
'occurred_on' => $message->occurredOn()->getTimestamp(), | ||
'attributes' => array_merge(['aggregate_id' => $message->aggregateId()->value()], $message->messagePayload()), | ||
] | ||
); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Serialization/SchemaValidatorSimpleMessageSerializable.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,20 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Pccomponentes\OpenApiMessagingContext\Serialization; | ||
|
||
use Pccomponentes\Ddd\Util\Message\Serialization\SimpleMessageSerializable; | ||
use Pccomponentes\Ddd\Util\Message\SimpleMessage; | ||
|
||
final class SchemaValidatorSimpleMessageSerializable implements SimpleMessageSerializable | ||
{ | ||
public function serialize(SimpleMessage $message) | ||
{ | ||
return \json_encode( | ||
[ | ||
'message_id' => $message->messageId(), | ||
'type' => $message::messageName(), | ||
'attributes' => $message->messagePayload(), | ||
] | ||
); | ||
} | ||
} |