Skip to content

Commit

Permalink
Merge pull request #35 from codeliner/interface_descriptions
Browse files Browse the repository at this point in the history
Improve interface descriptions
  • Loading branch information
prolic committed Aug 23, 2015
2 parents 59d8c20 + c908c31 commit ffb3a5d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/Messaging/MessageConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
interface MessageConverter
{
/**
* The result array MUST contain the following data structure:
*
* [
* 'message_name' => string,
* 'uuid' => string,
* 'version' => int,
* 'payload' => array, //MUST only contain sub arrays and/or scalar types, objects, etc. are not allowed!
* 'metadata' => array, //MUST only contain key/value pairs with values being only scalar types!
* 'created_at' => string, //formatted \DateTime
* ]
*
* @param Message $domainMessage
* @return array
Expand Down
10 changes: 9 additions & 1 deletion src/Messaging/MessageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@
interface MessageFactory
{
/**
* Message data should contain at least a "payload" key
* Message data MUST contain at least a "payload" key
* but may also contain "uuid", "message_name", "version", "metadata", and "created_at".
*
* If one of the optional keys is not part of the message data the factory should use a default instead:
* For example:
* uuid = Uuid::uuid4()
* message_name = $messageName //First parameter passed to the method
* version = 1
* metadata = []
* created_at = new \DateTimeImmutable('now', new \DateTimeZone('UTC')) //We recommend using UTC
*
* @param string $messageName
* @param array $messageData
* @return Message
Expand Down

0 comments on commit ffb3a5d

Please sign in to comment.