PHP Class AMQPConnection

Afficher le fichier Open project: pdezwart/php-amqp Class Usage Examples

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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() public méthode

This method will initiate a connection with the AMQP broker.
public connect ( ) : boolean
Résultat boolean TRUE on success or throw an exception on failure.

disconnect() public méthode

This method will close an open connection with the AMQP broker.
public disconnect ( ) : boolean
Résultat boolean true if connection was successfully closed, false otherwise.

getCACert() public méthode

Get path to the CA cert file in PEM format
public getCACert ( ) : string
Résultat string

getCert() public méthode

Get path to the client certificate in PEM format
public getCert ( ) : string
Résultat string

getHeartbeatInterval() public méthode

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
Résultat integer

getHost() public méthode

Get the configured host.
public getHost ( ) : string
Résultat string The configured hostname of the broker

getKey() public méthode

Get path to the client key in PEM format
public getKey ( ) : string
Résultat string

getLogin() public méthode

Get the configured login.
public getLogin ( ) : string
Résultat string The configured login as a string.

getMaxChannels() public méthode

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
Résultat integer

getMaxFrameSize() public méthode

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
Résultat integer

getPassword() public méthode

Get the configured password.
public getPassword ( ) : string
Résultat string The configured password as a string.

getPort() public méthode

Get the configured port.
public getPort ( ) : integer
Résultat integer The configured port as an integer.

getReadTimeout() public méthode

Get the configured interval of time to wait for income activity from AMQP broker
public getReadTimeout ( ) : float
Résultat float

getTimeout() public méthode

Get the configured interval of time to wait for income activity from AMQP broker
Deprecation: use AMQPConnection::getReadTimout() instead
public getTimeout ( ) : float
Résultat float

getUsedChannels() public méthode

Return last used channel id during current connection session.
public getUsedChannels ( ) : integer
Résultat integer

getVerify() public méthode

Get whether peer verification enabled or disabled
public getVerify ( ) : boolean
Résultat boolean

getVhost() public méthode

Get the configured vhost.
public getVhost ( ) : string
Résultat string The configured virtual host as a string.

getWriteTimeout() public méthode

Get the configured interval of time to wait for outcome activity to AMQP broker
public getWriteTimeout ( ) : float
Résultat float

isConnected() public méthode

It does so by checking the return status of the last connect-command.
public isConnected ( ) : boolean
Résultat boolean True if connected, false otherwise.

isPersistent() public méthode

When connection is not connected, boolean false always returned
public isPersistent ( ) : boolean
Résultat boolean

pconnect() public méthode

This method will initiate a connection with the AMQP broker or reuse an existing one if present.
public pconnect ( ) : boolean
Résultat boolean TRUE on success or throws an exception on failure.

pdisconnect() public méthode

This method will close an open persistent connection with the AMQP broker.
public pdisconnect ( ) : boolean
Résultat boolean true if connection was found and closed, false if no persistent connection with this host, port, vhost and login could be found,

preconnect() public méthode

Close any open persistent connections and initiate a new one with the AMQP broker.
public preconnect ( ) : boolean
Résultat boolean TRUE on success or FALSE on failure.

reconnect() public méthode

Close any open transient connections and initiate a new one with the AMQP broker.
public reconnect ( ) : boolean
Résultat boolean TRUE on success or FALSE on failure.

setCACert() public méthode

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

setCert() public méthode

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

setHost() public méthode

Set the hostname used to connect to the AMQP broker.
public setHost ( string $host ) : boolean
$host string The hostname of the AMQP broker.
Résultat boolean TRUE on success or FALSE on failure.

setKey() public méthode

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

setLogin() public méthode

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.
Résultat boolean TRUE on success or FALSE on failure.

setPassword() public méthode

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.
Résultat boolean TRUE on success or FALSE on failure.

setPort() public méthode

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.
Résultat boolean TRUE on success or FALSE on failure.

setReadTimeout() public méthode

Sets the interval of time to wait for income activity from AMQP broker
public setReadTimeout ( integer $timeout ) : boolean
$timeout integer
Résultat boolean

setTimeout() public méthode

Sets the interval of time to wait for income activity from AMQP broker
Deprecation: use AMQPConnection::setReadTimout($timeout) instead
public setTimeout ( integer $timeout ) : boolean
$timeout integer
Résultat boolean

setVerify() public méthode

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

setVhost() public méthode

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.
Résultat boolean true on success or false on failure.

setWriteTimeout() public méthode

Sets the interval of time to wait for outcome activity to AMQP broker
public setWriteTimeout ( integer $timeout ) : boolean
$timeout integer
Résultat boolean