@param string $message
@param string $exchange
@param string $routing_key
@param int    $flags One or more of AMQP_MANDATORY and AMQP_IMMEDIATE
@param array  $attributes

@return static
764731
public function publishMessage($message, $exchange, $routing_key = '', $flags = AMQP_NOPARAM, $attributes = [])
    {
        if (!isset($this->_exchanges[$exchange])) {
            throw new InvalidKeyException(['publish message to `:1` exchange with `:2` routing_key failed: exchange is NOT exists', $exchange, $routing_key]);
        }

        try {
            $this->_exchanges[$exchange]->publish($message, $routing_key, $flags, $attributes);
        } catch (\Exception $e) {
            throw new AmqpException(['publish message to `:1` exchange with `:2` routing_key failed: `:3`', $exchange, $routing_key, $e->getMessage()]);
        }

        return $this;
    }
805978
public function deleteExchange($name, $flags = AMQP_NOPARAM)
    {
        if (!isset($this->_exchanges[$name])) {
            throw new InvalidKeyException(['delete `:exchange` exchange failed: it is NOT exists', 'exchange' => $name]);
        }

        try {
            $this->_exchanges[$name]->delete($flags);
        } catch (\Exception $e) {
            throw new AmqpException(['delete `:exchange` exchange failed: :error', 'exchange' => $name, 'error' => $e->getMessage()]);
        }

        unset($this->_exchanges[$name]);

        return $this;
    }
854832
protected function replaceDifferent($message, $attribute, $rule, $parameters)
    {
        return $this->replaceSame($message, $attribute, $rule, $parameters);
    }
1195993
public function publish(string $message, string $routing_key = 'default')
    {
        return $this->amqpExchange->publish($message, $routing_key);
    }
1142537
public function ackMessage($message, $multiple = false)
    {
        if (is_array($message)) {
            if (!isset($message[self::MESSAGE_METADATA])) {
                throw new InvalidKeyException(['ack message failed: message not contains metadata information']);
            }
            $queue = $message[self::MESSAGE_METADATA]['queue'];
            $delivery_tag = $message[self::MESSAGE_METADATA]['delivery_tag'];
        } else {
            $queue = $message->getQueue();
            $delivery_tag = $message->getDeliveryTag();
        }

        if (!$this->_queues[$queue]) {
            throw new InvalidKeyException(['ack message failed: `:queue` queue is NOT exists', 'queue' => $queue]);
        }
        try {
            $this->_queues[$queue]->ack($delivery_tag, $multiple ? AMQP_MULTIPLE : AMQP_NOPARAM);
        } catch (\Exception $e) {
            throw new AmqpException(['ack `:queue` queue message failed: error', 'queue' => $queue, 'error' => $e->getMessage()]);
        }

        return $this;
    }
781579
public function declareExchange($name, $type = AMQP_EX_TYPE_DIRECT, $flags = AMQP_DURABLE)
    {
        if (isset($this->_exchanges[$name])) {
            throw new InvalidKeyException(['declare `:exchange` exchange failed: it is exists already', 'exchange' => $name]);
        }

        try {
            $exchange = new \AMQPExchange($this->_channel);

            $exchange->setName($name);
            $exchange->setType($type);
            $exchange->setFlags($flags);

            if (!$exchange->declareExchange()) {
                throw new AmqpException(['declare `:exchange` exchange failed', 'exchange' => $name]);
            }
        } catch (\Exception $e) {
            throw new AmqpException(['declare `:exchange` exchange failed: `:error`', 'exchange' => $name, 'error' => $e->getMessage()]);
        }

        $this->_exchanges[$name] = $exchange;

        return $exchange;
    }
1180050
protected function replaceInputPlaceholder($message, $attribute)
    {
        $actualValue = $this->getValue($attribute);

        if (is_scalar($actualValue) || is_null($actualValue)) {
            $message = str_replace(':input', $actualValue, $message);
        }

        return $message;
    }
340808
protected function replaceRequiredUnless($message, $attribute, $rule, $parameters)
    {
        $other = $this->getDisplayableAttribute($parameters[0]);

        $values = [];

        foreach (array_slice($parameters, 1) as $value) {
            $values[] = $this->getDisplayableValue($parameters[0], $value);
        }

        return str_replace([':other', ':values'], [$other, implode(', ', $values)], $message);
    }
412389
protected function replaceBefore($message, $attribute, $rule, $parameters)
    {
        if (! strtotime($parameters[0])) {
            return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message);
        }

        return str_replace(':date', $this->getDisplayableValue($attribute, $parameters[0]), $message);
    }
98913
public function basicPublish( \AMQP\Message $msg, $options = array())
    {
        $default = array('exchange' => '', 'routing_key' => '', 'mandatory' => false, 'immediate' => false,
                         'ticket' => null);
        $options = array_merge($default, $options);
        $options['ticket'] = $this->getTicket($options['ticket']);
        $args = $this->frameBuilder->basicPublish($options);

        $this->sendMethodFrame(array(60, 40), $args);

        $this->connection->sendContent(
            $this->channelId, 60, 0,
            strlen($msg->body),
            $msg->serializeProperties(),
            $msg->body
        );
    }
858398
private function sendMessages($messages, $attributes = [], $lead = null)
    {
        $accessToken = Config::get('access_token');

        if ($accessToken === null && $lead !== null) {
            $instance = $lead->instance()->first();
            
            if ($instance !== null) {
                Config::set($instance->meta);
            }
        }

        $batch = [];
        
        foreach ($messages as $message) {
            $message = $this->prepareMessage($message, $attributes, $lead);
            
            if ( ! empty($message)) {
                $batch[] = $message;
            }
        }
        
        $batch = array_values(array_filter($batch));
        
        $this->driver->sendMessages($batch);
    }
1347947
protected function replaceRequiredWith($message, $attribute, $rule, $parameters)
    {
        return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message);
    }
952079
public function validate(Request $request, array $rules, array $messages = [], array $attributes = [])
    {
        $this->getValidationFactory()
            ->make($request->all(), $rules, $messages, $attributes)
            ->validate();

        return $this->extractInputFromRules($request, $rules);
    }
1181995
public function exchangeBind($destination, $source, $routingKey = '', $nowait = false, $arguments = [])
    {
        return $this->getClient()->exchangeBind($this->getChannelId(), $destination, $source, $routingKey, $nowait, $arguments);
    }
1369283
private function parseRoute(Input $definition, TypeCollection $types, array $attributes): RoutePath
    {
        $char = $definition->peek();

        if ($char === "{") {
            return $this->parseAttribute($definition, $types, $attributes);
        }

        if ($char === "[") {
            return $this->parseOptional($definition, $types, $attributes);
        }

        if ($char === "}") {
            throw InvalidRoute::unexpectedCharacter($definition, $attributes);
        }

        if ($char === "]" || $char === Input::END) {
            return new EmptyPath();
        }

        return $this->parseStatic($definition, $types, $attributes);
    }
1042988
def publish(self, message, routing_key=None):
        
        if routing_key is None:
            routing_key = self.routing_key
        return self.client.publish_to_exchange(self.name, message=message, routing_key=routing_key)
282519
public static function send($eventKey, array $data, $ip = "0.0.0.0")
    {

        $id = self::getId($ip);
        $ventData = [
            '_id'       => $id,
            'eventKey'  => $eventKey,
            'data'      => $data,
            'ip'        => $ip,
        ];
        $exchangeName   = Helper::getExchangeName();
        $rabbitMq       = new RabbitMq($exchangeName);
        $routeKey       = "route_gateway";
        $rabbitMq->send($ventData, $routeKey);
        return $id;
    }