PHP Класс AMQPConnection

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( array $credentials = [] ) Create an instance of AMQPConnection.
connect ( ) : boolean Establish a transient connection with the AMQP broker.
disconnect ( ) : boolean Closes the transient connection with the AMQP broker.
getCACert ( ) : string Get path to the CA cert file in PEM format
getCert ( ) : string Get path to the client certificate in PEM format
getHeartbeatInterval ( ) : integer Get number of seconds between heartbeats of the connection in seconds.
getHost ( ) : string Get the configured host.
getKey ( ) : string Get path to the client key in PEM format
getLogin ( ) : string Get the configured login.
getMaxChannels ( ) : integer Get the maximum number of channels the connection can handle.
getMaxFrameSize ( ) : integer Get max supported frame size per connection in bytes.
getPassword ( ) : string Get the configured password.
getPort ( ) : integer Get the configured port.
getReadTimeout ( ) : float Get the configured interval of time to wait for income activity from AMQP broker
getTimeout ( ) : float Get the configured interval of time to wait for income activity from AMQP broker
getUsedChannels ( ) : integer Return last used channel id during current connection session.
getVerify ( ) : boolean Get whether peer verification enabled or disabled
getVhost ( ) : string Get the configured vhost.
getWriteTimeout ( ) : float Get the configured interval of time to wait for outcome activity to AMQP broker
isConnected ( ) : boolean Check whether the connection to the AMQP broker is still valid.
isPersistent ( ) : boolean Whether connection persistent.
pconnect ( ) : boolean Establish a persistent connection with the AMQP broker.
pdisconnect ( ) : boolean Closes a persistent connection with the AMQP broker.
preconnect ( ) : boolean Close any open persistent connections and initiate a new one with the AMQP broker.
reconnect ( ) : boolean Close any open transient connections and initiate a new one with the AMQP broker.
setCACert ( string $cacert ) Set path to the CA cert file in PEM format
setCert ( string $cert ) Set path to the client certificate in PEM format
setHost ( string $host ) : boolean Set the hostname used to connect to the AMQP broker.
setKey ( string $key ) Set path to the client key in PEM format
setLogin ( string $login ) : boolean Set the login string used to connect to the AMQP broker.
setPassword ( string $password ) : boolean Set the password string used to connect to the AMQP broker.
setPort ( integer $port ) : boolean Set the port used to connect to the AMQP broker.
setReadTimeout ( integer $timeout ) : boolean Sets the interval of time to wait for income activity from AMQP broker
setTimeout ( integer $timeout ) : boolean Sets the interval of time to wait for income activity from AMQP broker
setVerify ( boolean $verify ) Enable or disable peer verification
setVhost ( string $vhost ) : boolean Sets the virtual host to which to connect on the AMQP broker.
setWriteTimeout ( integer $timeout ) : boolean Sets the interval of time to wait for outcome activity to AMQP broker

Описание методов

__construct() публичный Метод

Creates an AMQPConnection instance representing a connection to an AMQP broker. A connection will not be established until AMQPConnection::connect() is called. $credentials = array( 'host' => amqp.host The host to connect too. Note: Max 1024 characters. 'port' => amqp.port Port on the host. 'vhost' => amqp.vhost The virtual host on the host. Note: Max 128 characters. 'login' => amqp.login The login name to use. Note: Max 128 characters. 'password' => amqp.password Password. Note: Max 128 characters. 'read_timeout' => Timeout in for income activity. Note: 0 or greater seconds. May be fractional. 'write_timeout' => Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional. 'connect_timeout' => Connection timeout. Note: 0 or greater seconds. May be fractional. Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details): 'channel_max' => Specifies highest channel number that the server permits. 0 means standard extension limit (see PHP_AMQP_MAX_CHANNELS constant) 'frame_max' => The largest frame size that the server proposes for the connection, including frame header and end-byte. 0 means standard extension limit (depends on librabbimq default frame size limit) 'heartbeat' => The delay, in seconds, of the connection heartbeat that the server wants. 0 means the server does not want a heartbeat. Note, librabbitmq has limited heartbeat support, which means heartbeats checked only during blocking calls. TLS support (see https://www.rabbitmq.com/ssl.html for details): 'cacert' => Path to the CA cert file in PEM format.. 'cert' => Path to the client certificate in PEM foramt. 'key' => Path to the client key in PEM format. 'verify' => Enable or disable peer verification. If peer verification is enabled then the common name in the server certificate must match the server name. Peer verification is enabled by default. )
public __construct ( array $credentials = [] )
$credentials array Optional array of credential information for connecting to the AMQP broker.

connect() публичный Метод

This method will initiate a connection with the AMQP broker.
public connect ( ) : boolean
Результат boolean TRUE on success or throw an exception on failure.

disconnect() публичный Метод

This method will close an open connection with the AMQP broker.
public disconnect ( ) : boolean
Результат boolean true if connection was successfully closed, false otherwise.

getCACert() публичный Метод

Get path to the CA cert file in PEM format
public getCACert ( ) : string
Результат string

getCert() публичный Метод

Get path to the client certificate in PEM format
public getCert ( ) : string
Результат string

getHeartbeatInterval() публичный Метод

When connection is connected, effective connection value returned, which is normally the same as original correspondent value passed to constructor, otherwise original value passed to constructor returned.
public getHeartbeatInterval ( ) : integer
Результат integer

getHost() публичный Метод

Get the configured host.
public getHost ( ) : string
Результат string The configured hostname of the broker

getKey() публичный Метод

Get path to the client key in PEM format
public getKey ( ) : string
Результат string

getLogin() публичный Метод

Get the configured login.
public getLogin ( ) : string
Результат string The configured login as a string.

getMaxChannels() публичный Метод

When connection is connected, effective connection value returned, which is normally the same as original correspondent value passed to constructor, otherwise original value passed to constructor returned.
public getMaxChannels ( ) : integer
Результат integer

getMaxFrameSize() публичный Метод

When connection is connected, effective connection value returned, which is normally the same as original correspondent value passed to constructor, otherwise original value passed to constructor returned.
public getMaxFrameSize ( ) : integer
Результат integer

getPassword() публичный Метод

Get the configured password.
public getPassword ( ) : string
Результат string The configured password as a string.

getPort() публичный Метод

Get the configured port.
public getPort ( ) : integer
Результат integer The configured port as an integer.

getReadTimeout() публичный Метод

Get the configured interval of time to wait for income activity from AMQP broker
public getReadTimeout ( ) : float
Результат float

getTimeout() публичный Метод

Get the configured interval of time to wait for income activity from AMQP broker
Устаревший: use AMQPConnection::getReadTimout() instead
public getTimeout ( ) : float
Результат float

getUsedChannels() публичный Метод

Return last used channel id during current connection session.
public getUsedChannels ( ) : integer
Результат integer

getVerify() публичный Метод

Get whether peer verification enabled or disabled
public getVerify ( ) : boolean
Результат boolean

getVhost() публичный Метод

Get the configured vhost.
public getVhost ( ) : string
Результат string The configured virtual host as a string.

getWriteTimeout() публичный Метод

Get the configured interval of time to wait for outcome activity to AMQP broker
public getWriteTimeout ( ) : float
Результат float

isConnected() публичный Метод

It does so by checking the return status of the last connect-command.
public isConnected ( ) : boolean
Результат boolean True if connected, false otherwise.

isPersistent() публичный Метод

When connection is not connected, boolean false always returned
public isPersistent ( ) : boolean
Результат boolean

pconnect() публичный Метод

This method will initiate a connection with the AMQP broker or reuse an existing one if present.
public pconnect ( ) : boolean
Результат boolean TRUE on success or throws an exception on failure.

pdisconnect() публичный Метод

This method will close an open persistent connection with the AMQP broker.
public pdisconnect ( ) : boolean
Результат boolean true if connection was found and closed, false if no persistent connection with this host, port, vhost and login could be found,

preconnect() публичный Метод

Close any open persistent connections and initiate a new one with the AMQP broker.
public preconnect ( ) : boolean
Результат boolean TRUE on success or FALSE on failure.

reconnect() публичный Метод

Close any open transient connections and initiate a new one with the AMQP broker.
public reconnect ( ) : boolean
Результат boolean TRUE on success or FALSE on failure.

setCACert() публичный Метод

Set path to the CA cert file in PEM format
public setCACert ( string $cacert )
$cacert string

setCert() публичный Метод

Set path to the client certificate in PEM format
public setCert ( string $cert )
$cert string

setHost() публичный Метод

Set the hostname used to connect to the AMQP broker.
public setHost ( string $host ) : boolean
$host string The hostname of the AMQP broker.
Результат boolean TRUE on success or FALSE on failure.

setKey() публичный Метод

Set path to the client key in PEM format
public setKey ( string $key )
$key string

setLogin() публичный Метод

Set the login string used to connect to the AMQP broker.
public setLogin ( string $login ) : boolean
$login string The login string used to authenticate with the AMQP broker.
Результат boolean TRUE on success or FALSE on failure.

setPassword() публичный Метод

Set the password string used to connect to the AMQP broker.
public setPassword ( string $password ) : boolean
$password string The password string used to authenticate with the AMQP broker.
Результат boolean TRUE on success or FALSE on failure.

setPort() публичный Метод

Set the port used to connect to the AMQP broker.
public setPort ( integer $port ) : boolean
$port integer The port used to connect to the AMQP broker.
Результат boolean TRUE on success or FALSE on failure.

setReadTimeout() публичный Метод

Sets the interval of time to wait for income activity from AMQP broker
public setReadTimeout ( integer $timeout ) : boolean
$timeout integer
Результат boolean

setTimeout() публичный Метод

Sets the interval of time to wait for income activity from AMQP broker
Устаревший: use AMQPConnection::setReadTimout($timeout) instead
public setTimeout ( integer $timeout ) : boolean
$timeout integer
Результат boolean

setVerify() публичный Метод

Enable or disable peer verification
public setVerify ( boolean $verify )
$verify boolean

setVhost() публичный Метод

Sets the virtual host to which to connect on the AMQP broker.
public setVhost ( string $vhost ) : boolean
$vhost string The virtual host to use on the AMQP broker.
Результат boolean true on success or false on failure.

setWriteTimeout() публичный Метод

Sets the interval of time to wait for outcome activity to AMQP broker
public setWriteTimeout ( integer $timeout ) : boolean
$timeout integer
Результат boolean