/**
  * @param RemoteMessage $aMessage
  * @return WorkflowMessage
  * @throws \RuntimeException
  */
 public static function fromServiceBusMessage(RemoteMessage $aMessage)
 {
     $payload = $aMessage->payload();
     Assertion::keyExists($payload, 'json');
     Assertion::keyExists($payload, 'origin');
     Assertion::keyExists($payload, 'target');
     $origin = $payload['origin'];
     $target = $payload['target'];
     $taskListPosition = isset($payload['processTaskListPosition']) ? TaskListPosition::fromString($payload['processTaskListPosition']) : null;
     $messagePayload = Payload::fromJsonDecodedData(json_decode($payload['json'], true));
     $metadata = isset($payload['metadata']) ? $payload['metadata'] : [];
     return new static($messagePayload, $aMessage->name(), $origin, $target, $metadata, $taskListPosition, $aMessage->header()->version(), $aMessage->header()->createdAt(), $aMessage->header()->uuid());
 }
Exemple #2
0
 /**
  * @param RemoteMessage $aMessage
  * @return LogMessage
  * @throws \RuntimeException
  */
 public static function fromServiceBusMessage(RemoteMessage $aMessage)
 {
     $payload = $aMessage->payload();
     Assertion::keyExists($payload, 'processTaskListPosition');
     Assertion::keyExists($payload, 'origin');
     Assertion::keyExists($payload, 'technicalMsg');
     Assertion::keyExists($payload, 'msgParams');
     Assertion::keyExists($payload, 'msgCode');
     $taskListPosition = TaskListPosition::fromString($payload['processTaskListPosition']);
     return new self($payload['origin'], $taskListPosition, $payload['technicalMsg'], $payload['msgCode'], $payload['msgParams'], $aMessage->header()->uuid(), $aMessage->header()->createdAt());
 }