@param MessageInterface $message
@param string           $from

@return Exchange

@throws \Exception
347625
protected function createExchangeForMessageFromURI(MessageInterface $message, $from)
    {
        $version = $message->getContext()->get(Context::FLOWS_VERSION);
        $params = $this->itineraryResolver->getItineraryParams($from, $version);
        $itinerary = $params[InternalRouter::KEY_ITINERARY];

        $exchange = new Exchange($message, clone $itinerary);
        $exchange->setHeader(Exchange::HEADER_HANDLER, $this->getId());
        $exchange->setHeader(Exchange::HEADER_FROM, $from);

        foreach ($this->itineraryResolver->filterItineraryParamsToPropagate($params) as $key => $value) {
            $exchange->setHeader($key, $value);
        }

        return $exchange;
    }
658885
public function copy( $from, $to )
	{
		try {
			$this->fs->copy( $from, $to );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1014812
public function onMessage(ConnectionInterface $from, $msg) {
    $data = json_decode($msg, true);
    if (!$data['action']
        || !in_array(
            $data['action'],
            ['authenticate', 'subscribe', 'unsubscribe', 'publish']
        )) {
      return;
    }
    switch ($data['action']) {
      case 'authenticate':
        $this->handleAuthentication($from, $data);
        break;
      case 'subscribe':
      case 'unsubscribe':
        $this->handleSubscription($from, $data);
        break;
      case 'publish':
        $this->handlePublish($from, $msg, $data);
        break;
    }
  }
1013643
public function endpoint_sendmessage($to = NULL, $from = NULL, $body = NULL)
        {
            return $this->sendmessage($to, $from, $body);
        }
51078
public function from($from, $name = null)
    {
        $this->from = ($name !== null) ? (ucwords($name) . " <{$from}>") : $from;

        return $this;
    }
891881
public function modify(MessageInterface $message) : MessageInterface
    {
        /** @var MessageModifierInterface $modifier */
        foreach ($this->collection as $modifier) {
            $message = $modifier->modify($message);
        }

        return $message;
    }
170142
public function message($from, $to, $body, $type = 'chat', $style='', $timestamp = null) {
        if(!$timestamp) $timestamp = microtime(true) * 1000;
		$data = array_merge($this->reqdata(), array(
			'nick' => $this->endpoint->nick,
			'to' => $to,
			'type' => $type,
			'body' => $body,
			'style' => $style,
			'timestamp' => $timestamp,
		));
        if($from) $data['from'] = $from;
		return $this->request('messages', $data, 'POST');
	}
893068
public function onMessage(ConnectionInterface $from, $msg) {
        $from = $this->connections[$from];

        if (null === ($json = @json_decode($msg, true))) {
            throw new JsonException;
        }

        if (!is_array($json) || $json !== array_values($json)) {
            throw new Exception("Invalid WAMP message format");
        }

        if (isset($json[1]) && !(is_string($json[1]) || is_numeric($json[1]))) {
            throw new Exception('Invalid Topic, must be a string');
        }

        switch ($json[0]) {
            case static::MSG_PREFIX:
                $from->WAMP->prefixes[$json[1]] = $json[2];
            break;

            case static::MSG_CALL:
                array_shift($json);
                $callID  = array_shift($json);
                $procURI = array_shift($json);

                if (count($json) == 1 && is_array($json[0])) {
                    $json = $json[0];
                }

                $this->_decorating->onCall($from, $callID, $from->getUri($procURI), $json);
            break;

            case static::MSG_SUBSCRIBE:
                $this->_decorating->onSubscribe($from, $from->getUri($json[1]));
            break;

            case static::MSG_UNSUBSCRIBE:
                $this->_decorating->onUnSubscribe($from, $from->getUri($json[1]));
            break;

            case static::MSG_PUBLISH:
                $exclude  = (array_key_exists(3, $json) ? $json[3] : null);
                if (!is_array($exclude)) {
                    if (true === (boolean)$exclude) {
                        $exclude = [$from->WAMP->sessionId];
                    } else {
                        $exclude = [];
                    }
                }

                $eligible = (array_key_exists(4, $json) ? $json[4] : []);

                $this->_decorating->onPublish($from, $from->getUri($json[1]), $json[2], $exclude, $eligible);
            break;

            default:
                throw new Exception('Invalid WAMP message type');
        }
    }
726168
private function getChannels(MessageInterface $message, RecipientInterface $recipient)
    {
        $channels = $this->channelResolver
            ->getChannels($message->getType(), $this->getChannelStore());

        return $this->channelResolver
            ->filterChannels($recipient, $message->getType(), $channels);
    }
538563
public function send(MessageInterface $message)
    {
        if (!$message instanceof BlackberryMessage) {
            throw new InvalidMessageTypeException(sprintf("Message type '%s' not supported by Blackberry", get_class($message)));
        }

        return $this->doSend($message);
    }
725770
public function send(MailMessage $message)
    {
        $this->headers->add(new Header('From', $message->getFrom()));

        $this->mailer->send($message, $this->headers);
    }
432271
public function send(MessageInterface $message, $skipErrors = true) {

        $mobitex = $this->getClient();
        
        foreach ($message->getRecipient() as $recipient) {
            try {
                $mobitex->sendMessage($recipient, $message->getText());
            }
            catch (Exception $e) {
                $this->addError(new SendingError($recipient, $e->getCode(), $e->getMessage()));
                if (!$skipErrors) {
                    throw new \RuntimeException($e->getMessage(), $e->getCode());
                }
            }
        }
        return $this->getErrors()->count() === 0;
    }
279246
public static function fromMessage(Message $msg)
    {
        $workerStatus = array();
        while ($msg->peek() !== null) {
            $id = $msg->shift();
            $actionCount = (int) $msg->shift();
            $actionList = array();
            for ($i = 0; $i < $actionCount; $i++) {
                $actionList[] = $msg->shift();
            }

            $workerStatus[$id] = array(
                'id'          => $id,
                'actionList'  => $actionList,
                'current'     => $msg->shift(),
                'ready'       => (bool) $msg->shift(),
                'valid'       => (bool) $msg->shift(),
            );
        }

        return new self($workerStatus);
    }
147240
public function preProcessMessage(MessageInterface $message)
    {
        foreach ($this->getProcessorStore()->getProcessors() as $processor) {
            $message = $processor->preProcessMessage($message);
        }

        return $message;
    }
354142
public function setFrom($from)
    {
	$result = $this->_senderResolver->resolve($from, $this->getStoreId());
        $this->setSenderMail($result);
        $this->message->setFrom($result['email'], $result['name']);
        
        return $this;
    }
113699
protected function sendMessage(Message $message, string $connectionName = null): MessageEnvelope
    {
        /* @var AppleMessage $message */
        try {
            $envelope = $this->createMessageEnvelope($message);
            $connection = $this->getConnectionHandler()->getConnection($connectionName);
            $response = $connection->sendAndReceive($message);
            $envelope->setResponse($response);
            if ($response->isSuccess()) {
                $envelope->setState(MessageEnvelope::SUCCESS);
            } else {
                $envelope->setState(MessageEnvelope::FAILED);
            }

            return $envelope;
        } catch (Exception $e) {
            $this->getLogger()->error('Exception occurred sending an apple message: ' . $e->getMessage());
            throw new AppleNotifyFailedException($e->getMessage(), $e->getCode(), $e);
        }
    }
852160
public function sendMessage(MessageInterface $message, array $recipients)
    {
        $messageProcessor = new MessageProcessor($this->getProcessorStore());
        $message = $messageProcessor->preProcessMessage($message);

        foreach ($recipients as $recipient) {
            foreach ($this->getChannels($message, $recipient) as $channel) {
                $processedMessage = $messageProcessor
                    ->processMessage(clone($message), $recipient);
                if ($channel->isHandling($processedMessage, $recipient)) {
                    $channel->send($processedMessage, $recipient);
                }
            }
        }
    }