AMQPConnection
class AMQPConnection (View source)
stub class representing AMQPConnection from pecl-amqp
Methods
Create an instance of AMQPConnection.
Check whether the connection to the AMQP broker is still valid.
Whether connection persistent.
Establish a transient connection with the AMQP broker.
Closes the transient connection with the AMQP broker.
Close any open transient connections and initiate a new one with the AMQP broker.
Establish a persistent connection with the AMQP broker.
Closes a persistent connection with the AMQP broker.
Close any open persistent connections and initiate a new one with the AMQP broker.
Get the configured host.
Get the configured login.
Get the configured password.
Get the configured port.
Get the configured vhost.
Set the hostname used to connect to the AMQP broker.
Set the login string used to connect to the AMQP broker.
Set the password string used to connect to the AMQP broker.
Set the port used to connect to the AMQP broker.
Sets the virtual host to which to connect on the AMQP broker.
Sets the interval of time to wait for income activity from AMQP broker
Get the configured interval of time to wait for income activity from AMQP broker
Sets the interval of time to wait for income activity from AMQP broker
Get the configured interval of time to wait for income activity from AMQP broker
Sets the interval of time to wait for outcome activity to AMQP broker
Get the configured interval of time to wait for outcome activity to AMQP broker
Get the configured timeout (in seconds) for connecting to the AMQP broker
Sets the interval of time to wait for RPC activity to AMQP broker
Get the configured interval of time to wait for RPC activity to AMQP broker
Return last used channel id during current connection session.
Get the maximum number of channels the connection can handle.
Get max supported frame size per connection in bytes.
Get number of seconds between heartbeats of the connection in seconds.
Get path to the CA cert file in PEM format
Set path to the CA cert file in PEM format
Get path to the client certificate in PEM format
Set path to the client certificate in PEM format
Get path to the client key in PEM format
Set path to the client key in PEM format
Get whether peer verification enabled or disabled
Enable or disable peer verification
set authentication method
Get authentication mechanism configuration
No description
No description
Details
__construct(array $credentials = [])
Create an instance of AMQPConnection.
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. 'rpc_timeout' => RPC 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.
'connection_name' => A user determined name for the connection
)
bool
isConnected()
Check whether the connection to the AMQP broker is still valid.
Cannot reliably detect dropped connections or unusual socket errors, as it does not actively engage the socket.
bool
isPersistent()
Whether connection persistent.
When no connection is established, it will always return FALSE. The same disclaimer as for {\AMQPConnection::isConnected()} applies.
void
connect()
Establish a transient connection with the AMQP broker.
This method will initiate a connection with the AMQP broker.
void
disconnect()
Closes the transient connection with the AMQP broker.
This method will close an open connection with the AMQP broker.
void
reconnect()
Close any open transient connections and initiate a new one with the AMQP broker.
void
pconnect()
Establish a persistent connection with the AMQP broker.
This method will initiate a connection with the AMQP broker or reuse an existing one if present.
void
pdisconnect()
Closes a persistent connection with the AMQP broker.
This method will close an open persistent connection with the AMQP broker.
void
preconnect()
Close any open persistent connections and initiate a new one with the AMQP broker.
string
getHost()
Get the configured host.
string
getLogin()
Get the configured login.
string
getPassword()
Get the configured password.
int
getPort()
Get the configured port.
string
getVhost()
Get the configured vhost.
void
setHost(string $host)
Set the hostname used to connect to the AMQP broker.
void
setLogin(string $login)
Set the login string used to connect to the AMQP broker.
void
setPassword(string $password)
Set the password string used to connect to the AMQP broker.
void
setPort(int $port)
Set the port used to connect to the AMQP broker.
void
setVhost(string $vhost)
Sets the virtual host to which to connect on the AMQP broker.
void
setTimeout(float $timeout)
deprecated
deprecated
Sets the interval of time to wait for income activity from AMQP broker
float
getTimeout()
deprecated
deprecated
Get the configured interval of time to wait for income activity from AMQP broker
void
setReadTimeout(float $timeout)
Sets the interval of time to wait for income activity from AMQP broker
float
getReadTimeout()
Get the configured interval of time to wait for income activity from AMQP broker
void
setWriteTimeout(float $timeout)
Sets the interval of time to wait for outcome activity to AMQP broker
float
getWriteTimeout()
Get the configured interval of time to wait for outcome activity to AMQP broker
float
getConnectTimeout()
Get the configured timeout (in seconds) for connecting to the AMQP broker
void
setRpcTimeout(float $timeout)
Sets the interval of time to wait for RPC activity to AMQP broker
float
getRpcTimeout()
Get the configured interval of time to wait for RPC activity to AMQP broker
int
getUsedChannels()
Return last used channel id during current connection session.
int
getMaxChannels()
Get the maximum number of channels the connection can handle.
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.
int
getMaxFrameSize()
Get max supported frame size per connection in bytes.
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.
int
getHeartbeatInterval()
Get number of seconds between heartbeats of the connection in seconds.
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.
string|null
getCACert()
Get path to the CA cert file in PEM format
void
setCACert(string $cacert)
Set path to the CA cert file in PEM format
string|null
getCert()
Get path to the client certificate in PEM format
void
setCert(string $cert)
Set path to the client certificate in PEM format
string|null
getKey()
Get path to the client key in PEM format
void
setKey(string|null $key)
Set path to the client key in PEM format
bool
getVerify()
Get whether peer verification enabled or disabled
void
setVerify(bool $verify)
Enable or disable peer verification
void
setSaslMethod($method)
set authentication method
int
getSaslMethod()
Get authentication mechanism configuration
void
setConnectionName(string|null $connectionName)
No description
string|null
getConnectionName()
No description