Skip to content
Go to file
Cannot retrieve contributors at this time
36 lines (32 sloc) 1.3 KB
* This file is part of prooph/common.
* (c) 2014-2019 Alexander Miertsch <>
* (c) 2015-2019 Sascha-Oliver Prolic <>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
namespace Prooph\Common\Messaging;
interface MessageFactory
* Message data MUST contain at least a "payload" key
* but may also contain "uuid", "message_name", "metadata", and "created_at".
* In general the message factory MUST support creating event objects from an array returned by
* the corresponding Prooph\Common\Messaging\MessageConverter
* You can use the assertion helper Prooph\Common\Messaging\MessageDataAssertion to assert message data
* before processing it.
* 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
* metadata = []
* created_at = new \DateTimeImmutable('now', new \DateTimeZone('UTC')) //We treat all dates as UTC
public function createMessageFromArray(string $messageName, array $messageData): Message;
You can’t perform that action at this time.