Message handler

@param  PhpAmqpLib\Message\AMQPMessage $message
@return void
163228
public function messageHandler(PhpAmqpLib\Message\AMQPMessage $message)
    {
        echo "\n--------\n";
        echo $message->body;
        echo "\n--------\n";

        $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']);
        if ($message->body === 'quit') {
            $message->delivery_info['channel']->basic_cancel($message->delivery_info['consumer_tag']);
        }
    }
465311
private function autoTypeHandle($message)
    {
        $autoTyping = $this->config->get('fb-messenger.auto_typing');
        if ($autoTyping) {
            $handler = $this->createBot($this->app->make(AutoTypingHandler::class));
            $handler->handle($message);
        }
    }
817701
public function fromProducedMessage(AMQPMessage $message)
    {
        $currentSpan = $this->spanStack->current();

        return new Span(
            $this->identifierGenerator->generate(),
            $this->getMessageName($message),
            null !== $currentSpan ? $currentSpan->getTraceIdentifier() : $this->identifierGenerator->generate(),
            [
                new Annotation(Annotation::CLIENT_SEND, $this->clock->microseconds(), $this->endpointResolver->resolve()),
            ],
            [],
            $currentSpan !== null ? $currentSpan->getIdentifier() : null,
            $currentSpan !== null ? $currentSpan->getDebug() : null,
            $this->clock->microseconds()
        );
    }
557648
protected function handleStandard($message)
	{
		// if we dont have any handlers for this event, then just return out
		if (!array_key_exists($message->Event, $this->handlers[static::MESSAGE_TYPE_STANDARD]))
		{
			return;
		}

		// pass the message to each of the corrosponding handlers
		foreach ($this->handlers[static::MESSAGE_TYPE_STANDARD][$message->Event] as $handle)
		{
			$handle($message);
		}
	}
194653
public function setError(?string $message = null) : void
    {
        $this->is_valid = false;
        $this->error = (null === $message) ? $this->default_error : $message;
    }
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();
    }
305894
public function handle(InitMessage $message)
    {
        $output = $message->getOutput();
        $configStorage = $message->getConfigStorage();

        if ($configStorage->isInitialized($message->getConfig())) {
            $output->writeln(sprintf(
                '%s is already initialised!',
                $message->getCliCommand()->getApplication()->getName()
            ));

            return;
        }

        $result = $configStorage->write($message->getConfig());

        if ($result !== false) {
            $msg = sprintf('Config file created at "<info>%s</info>".', $message->getConfig()->getFileName());
        } else {
            $msg = sprintf(
                '<error>Error: Could not create and write file "<info>%s</info>". '.
                'Please check file and directory permissions.</error>',
                $message->getConfig()->getFileName()
            );
        }
        $output->writeln($msg);
    }
519299
public function fromConsumedMessage(AMQPMessage $message)
    {
        return new Span(
            $this->getIdentifierOrGenerate($message, 'X-B3-SpanId'),
            $this->getMessageName($message),
            $this->getIdentifierOrGenerate($message, 'X-B3-TraceId'),
            [
                new Annotation(Annotation::SERVER_SEND, $this->clock->microseconds(), $this->endpointResolver->resolve()),
            ],
            [],
            $this->getIdentifier($message, 'X-B3-ParentSpanId'),
            $this->getMessageHeader($message, 'X-B3-Flags') == '1'
        );
    }
1069468
public function run(TestMessage $message)
    {
        $this->environment->load($this->reader);
        $this->message = $message;
        $this->listen($this->environment->getEventEmitter());
        $context = Context::getInstance();
        $this->looper->loop($context, $this->environment, $message);
    }
334917
public function handles(Message $message): bool
    {
        try {
            $this->getNotifierForMessage($message);

            return true;
        } catch (NotifierNotFoundException $e) {
            return false;
        }
    }
758292
protected function appendMessage(Message $message): void
    {
        $this->messages[] = $message;

        if (sizeof($this->messages) > 100) {
            array_shift($this->messages);
        }
    }
725770
public function send(MailMessage $message)
    {
        $this->headers->add(new Header('From', $message->getFrom()));

        $this->mailer->send($message, $this->headers);
    }
1104036
public function logMessage(Message $message): void
    {
        if (in_array($message->getLevel(), $this->config['log'])) {
            if ($this->config['send_immediately']) {

                call_user_func($this->config['exec'], $message);

            } else {
                $this->messages[] = $message;

                if (count($this->messages) == 1) {
                    // register shutdown on first message in queue
                    $self = $this;
                    register_shutdown_function(function () use ($self) {
                        $fn = $self->getExecFunction();
                        call_user_func($fn, $self->getMessages());
                    });
                }
            }
        }
    }
876555
public function logMessage(Message $message): void
    {
        if (in_array($message->getLevel(), $this->config['log'])) {
            if ($this->getMessageFunction !== null) {
                $line = call_user_func($this->getMessageFunction, $message);
            } else {
                $time = $message->getTime()->format('y-m-d H:i:s.v');
                $level = strtoupper($message->getLevel());
                $space = str_repeat(' ', 10 - strlen($level));
                $who = $message->getWho() ?? Log::getWho();
                $line = "{$time} {$level}{$space}{$who}\t{$message->getMessage()}\n";
            }

            if (is_string($line)) {
                print $line;
            }
        }
    }
1068148
public function onMessage(Mf4phpMessage $message) : void
    {
        Preconditions::checkArgument($message instanceof ObjectMessage, "Message must be an instance of ObjectMessage");
        $object = $message->getObject();
        if ($object instanceof MessageWrapper) {
            $object = $object->getMessage();
        }
        parent::dispatch($object, self::emptyCallback());
    }
969789
public function fromReceivedMessage(AMQPMessage $message)
    {
        return new Span(
            $this->getIdentifierOrGenerate($message, 'X-B3-SpanId'),
            $this->getMessageName($message),
            $this->getIdentifierOrGenerate($message, 'X-B3-TraceId'),
            [
                new Annotation(Annotation::SERVER_RECEIVE, $this->clock->microseconds(), $this->endpointResolver->resolve()),
            ],
            [],
            $this->getIdentifier($message, 'X-B3-ParentSpanId'),
            $this->getMessageHeader($message, 'X-B3-Flags') == '1'
        );
    }
389188
public function handle($message, callable $next)
    {
        $this->queue[] = $message;

        if (!$this->isHandling) {
            $this->isHandling = true;

            while ($message = array_shift($this->queue)) {
                try {
                    $next($message);
                } catch (Exception $exception) {
                    $this->isHandling = false;

                    throw $exception;
                }
            }

            $this->isHandling = false;
        }
    }