/**
* @inheritdoc
*/
public function submit($payload, array $options = [])
{
$messageId = Algorithms::generateUUID();
$message = new Message($messageId, $payload);
$commandArguments = [$this->name, base64_encode(serialize($message))];
if ($this->async) {
if (!method_exists(Scripts::class, 'executeCommandAsync')) {
throw new \RuntimeException('The "async" flag is set, but the currently used Flow version doesn\'t support this (Flow 3.3+ is required)', 1469116604);
}
Scripts::executeCommandAsync('flowpack.jobqueue.common:job:execute', $this->flowSettings, $commandArguments);
} else {
Scripts::executeCommand('flowpack.jobqueue.common:job:execute', $this->flowSettings, true, $commandArguments);
}
return $messageId;
}