Notifies the task manager given a message constant, see MESSAGE_* constants.

@param string $message

@return mixed|null The return value of the task manager.

@throws RuntimeException in case notification did not occur within the timeout.
164545
public function notify($message)
    {
        try {
            $command = $this->createCommand($message);
            $this->socket->send($command);

            $result = false;
            $limit = microtime(true) + $this->timeout;

            while (microtime(true) < $limit && false === $result = $this->socket->recv(\ZMQ::MODE_NOBLOCK)) {
                usleep(1000);
            }

            if (false === $result) {
                $this->logger->error(sprintf('Unable to notify the task manager with message "%s" within timeout of %d seconds', $message, $this->timeout));
                throw new RuntimeException('Unable to retrieve information.');
            }

            $data = @json_decode($result, true);
            if (JSON_ERROR_NONE !== json_last_error()) {
                throw new RuntimeException('Invalid task manager response : invalid JSON.');
            }
            if (!isset($data['reply']) || !isset($data['request']) || $command !== $data['request']) {
                throw new RuntimeException('Invalid task manager response : missing fields.');
            }

            return $data['reply'];
        } catch (\ZMQSocketException $e) {
            $this->logger->error(sprintf('Unable to notify the task manager with message "%s" within timeout of %d seconds', $message, $this->timeout), ['exception' => $e]);
            throw new RuntimeException('Unable to retrieve information.', $e->getCode(), $e);
        }
    }
343570
public function notify($to, $message)
    {
        $params = [
            'UN'      => Arr::get($this->config, 'username', ''),
            'PW'      => Arr::get($this->config, 'password', ''),
            'O'       => urlencode(Arr::get($this->config, 'sender', '')),
            'D'       => Arr::get($this->config, 'D', $to),
            'LONGSMS' => Arr::get($this->config, 'LONGSMS', ''),
            'M'       => $message,
        ];

        return $this->send($this->buildUrlFromString('http/get/SendSms.php'), array_filter($params));
    }
167875
protected static function _processMessage( &$message )
    {
        $_newIndent = 0;

        foreach ( static::$_indentTokens as $_key => $_token )
        {
            if ( $_token == substr( $message, 0, $_length = strlen( $_token ) ) )
            {
                $_newIndent = ( false === $_key ? -1 : 1 );
                $message = substr( $message, $_length );
            }
        }

        return $_newIndent;
    }
8711
public function getNotifiable($name)
    {
        $notifiables = $this->getDiscoveryNotifiables();
        if (isset($notifiables[$name])) {
            return $notifiables[$name];
        }

        throw new \RuntimeException('Notifiable not found.');
    }
1293338
private function tryLogMessage($message)
    {
        $messageId = null;

        if ($message instanceof RemoteMessage) $messageId = $message->header()->uuid();
        elseif ($message instanceof ProcessingMessage) $messageId = $message->uuid();

        if (! $messageId) return;

        $entry = $this->messageLogger->getEntryForMessageId($messageId);

        if ($entry) return;

        $this->messageLogger->logIncomingMessage($message);
    }
77567
protected function handleMessage($message)
    {
        $handler = $this->messageHandler;

        if (!is_callable($handler)) {
            Log::debug('No handler enabled.');

            return null;
        }

        Log::debug('Message detail:', $message->all());

        $type = $this->messageTypeMapping[ $message->get('InfoType') ];

        $response = null;

        if ($type) {
            $response = call_user_func_array($handler, [$message]);
        }

        return $response;
    }
815416
private function createException($message)
    {
        $error = error_get_last();

        if (isset($error['message'])) {
            $message .= sprintf(' (%s)', $error['message']);
        }

        return new \RuntimeException($message);
    }
313221
public function a($message) {
        return isset($this->messages[$message]) ? $this->messages[$message] : $message;
    }
582329
private function checkMessageStatus($message)
    {
        if (!$message || $message->success == 0 || $message->failure > 0) {
            throw new DispatchMessageException(
                sprintf("%d messages could not be processed", $message->failure)
            );
        }
    }
823250
public function notify($to, $message)
    {
        $params = [
            'to'          => $to,
            'service_key' => $this->config['token'],
            'event_type'  => Arr::get($this->config, 'event_type', 'trigger'),
            'client'      => Arr::get($this->config, 'client', null),
            'client_url'  => Arr::get($this->config, 'client_url', null),
            'details'     => Arr::get($this->config, 'details', null),
            'description' => $message,
        ];

        return $this->send($this->buildUrlFromString('create_event.json'), $params);
    }
333666
public function notify_success($message) {
        $n = new \core\output\notification($message, \core\output\notification::NOTIFY_SUCCESS);
        return $this->render($n);
    }
641476
public function release(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $time = new \DateTimeImmutable('now');
        $time = $time->modify('+' . $message->getDelay() . 'seconds');

        $values = [
            'reserved' => null,
            'visibility' => $time->format('Y-m-d H:i:s'),
        ];

        $this->db->getWriter()->updateBatch(
            $this->table,
            $values,
            [
                'id' => $message->getId(),
                'queue' => $queue,
            ]
        );

        return $this;
    }
885318
public function getLastRuntimeMessage()
    {
        end($this->runtime_messages);
        $value = current($this->runtime_messages);
        reset($this->runtime_messages);

        return $value;
    }
433274
public function notice($message, array $context = array()) {
        $context['fromClass'] = get_called_class();
        foreach ($this->loggersInstances as $logger) {
            $logger->notice($message, $context);
        }
    }
928325
public function sendMessage($message)
    {
        $message = sprintf("%s\r\n", $message);
        fwrite($this->getSocketStream(), $message, strlen($message));
        return $this->receiveMessage();
    }
154695
public function push(Message $message)
    {
        if (empty($this->params)) {
            throw new \RuntimeException('Please set up this client using setUp() method before pushing messages.');
        }

        $tokens = $message->getTokens();
        if (empty($tokens)) {
            throw new \RuntimeException('No device token set. Please add at least 1 token using Message::addToken() before trying to push the message.');
        }

        $payload = $message->getPayloadAsJson();

        $headers = array(
            'Authorization: key='.$this->params['api_access_key'],
            'Content-Type: application/json',
        );

        $this->logger->info('Sending GcmMessage to Google Cloud Messaging server', array(
            'payload' => $payload,
        ));

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->params['endpoint']);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
        curl_exec($ch);
        curl_close($ch);
    }
1319880
public function call(Message $message) : Message
    {
        $aggregate = $message->getHeaders()->containsKey(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
                            ? $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
                            : null;
        $methodInvoker = MethodInvoker::createWith(
            $aggregate ? $aggregate : $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_CLASS_NAME_HEADER),
            $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_METHOD_HEADER),
            $this->messageToParameterConverters
        );

        $resultMessage = MessageBuilder::fromMessage($message);
        try {
            $result = $methodInvoker->processMessage($message);

            if (!$aggregate) {
                $resultMessage = $resultMessage
                    ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER, $result);
            }
        } catch (\Throwable $e) {
            throw MessageHandlingException::fromOtherException($e, $message);
        }

        if (!is_null($result)) {
            $resultMessage = $resultMessage
                ->setPayload($result);
        }

        return $resultMessage
                ->build();
    }