Consumes a message

@param string $message
@param array  $headers

@return void
970787
public function consume($message, array $headers = [])
    {
        $eventStream = $this->serializer->deserialize($message);
        $this->eventBus->publish($eventStream);
    }
8812
public function setMessageAsMixed(Message $message)
    {
        if ($message->hasContent()) {
            $part = $this->genericHelper->createNewContentPartFrom($message);
            $message->addChild($part, 0);
        }
        $this->setMimeHeaderBoundaryOnPart($message, 'multipart/mixed');
        $atts = $message->getAllAttachmentParts();
        if (!empty($atts)) {
            foreach ($atts as $att) {
                $att->markAsChanged();
            }
        }
    }
277945
public function sendMessage(Message $message): void
    {
        // Ensure the message will always be sent to the default channel if asked for.
        if ($this->options['sticky_channel']) {
            $message->setChannel($this->options['channel']);
        }

        $payload = $this->preparePayload($message);

        $encoded = \json_encode($payload, JSON_UNESCAPED_UNICODE);

        if (false === $encoded) {
            throw new \RuntimeException(\sprintf('JSON encoding error %s: %s', \json_last_error(), \json_last_error_msg()));
        }

        $this->httpClient->post('', [], $encoded);
    }
1161665
public function addHeaders (array $headers)
    {
        if ($this->_sent) {
            throw new CAS_OutOfSequenceException(
                'Request has already been sent cannot '.__METHOD__
            );
        }

        $this->headers = array_merge($this->headers, $headers);
    }
1008115
protected function log($message): void
    {
        if ($this->logger !== null) {
            $this->logger->log($message);
        }
    }
1050748
public function consume($message, array $headers = [])
    {
        try {
            $this->transactionManager->beginTransaction();
        } catch (BeginException $e) {
            throw new ConsumerException($e->getMessage(), $e->getCode(), $e);
        }

        try {
            $this->consumer->consume($message, $headers);
            $this->transactionManager->commit();
        } catch (\Exception $e) {
            $this->transactionManager->rollback();
            throw $e;
        }
    }
1038603
protected function write($messages): void
    {
        if (! \is_array($messages)) {
            $messages = [$messages];
        }

        foreach ($messages as $i => $message) {
            $messages[$i] = '    - ' . $message;
        }

        $this->io->writeError($messages, true, IOInterface::VERBOSE);
    }
847894
public function handleWsMessage($message)
    {
        if ($message->isBinary()) {
            $data = zlib_decode($message->getPayload());
        } else {
            $data = $message->getPayload();
        }

        $data = json_decode($data);
        $this->emit('raw', [$data, $this]);

        if (isset($data->s)) {
            $this->seq = $data->s;
        }

        $op = [
            Op::OP_DISPATCH        => 'handleDispatch',
            Op::OP_HEARTBEAT       => 'handleHeartbeat',
            Op::OP_RECONNECT       => 'handleReconnect',
            Op::OP_INVALID_SESSION => 'handleInvalidSession',
            Op::OP_HELLO           => 'handleHello',
            Op::OP_HEARTBEAT_ACK   => 'handleHeartbeatAck',
        ];

        if (isset($op[$data->op])) {
            $this->{$op[$data->op]}($data);
        }
    }
726163
private static void addHeadersToMessage(SipServletMessage message, Map<String, String> customHeaders) {
         for (Map.Entry<String, String> entry: customHeaders.entrySet()) {
             String headerName = entry.getKey();
             String headerVal = entry.getValue();
             message.addHeader(headerName, headerVal);
         }
     }
742735
private function throwFatalError($message, $data = [], array $headers = [])
    {
        throw new HttpResponseException($this->fatalErrorResponse($message, $data, $headers));
    }
1012905
private void setHeaders(HttpMessage message, Map<String, String> headers) {
		message.setHeader(RequestHeaderKey.ACCEPT, RequestHeaderValue.Accept.ALL);
		message.setHeader(RequestHeaderKey.CONNECTION, RequestHeaderValue.Connection.KEEP_ALIVE);
		message.setHeader(RequestHeaderKey.USER_AGENT, this.config.getUserAgent());

		if (headers != null) {
			for (String headerKey : headers.keySet()) {
				message.setHeader(headerKey, headers.get(headerKey));
			}
		}
	}
946570
protected function headerToArray(MessageInterface $message, $header)
    {
        $lines = explode(Http::NEW_LINE, $header);

        foreach ($lines as $line) {
            $parts = explode(':', $line, 2);

            if (isset($parts[0]) && isset($parts[1])) {
                $key   = $parts[0];
                $value = substr($parts[1], 1);

                $message->addHeader($key, $value);
            }
        }
    }
1069376
public function logMessage(Message $message) {
        foreach($this->logger as $logger) {
            $logger->logMessage($message);
        }
    }
722983
public function headers( array $headers )
      : Request
   {

      $this->_defaultHeaders = array_merge( $this->_defaultHeaders, $headers );

      return $this;

   }
135599
public function log($message)
    {
        if (null !== $this->logger) {
            call_user_func(array($this->logger, $this->level), $message);
        }
    }
215691
private function throwBadRequest($message, $metadata = [], array $headers = [])
    {
        throw new HttpResponseException($this->badRequestResponse($message, $metadata, $headers));
    }
967225
public function addHeaders($headers = array())
    {
        foreach ($headers as $header => $value) {
            $this->addHeader($header, $value);
        }
    }