class AMQPConnection (View source)

stub class representing AMQPConnection from pecl-amqp

Methods

__construct(array $credentials = [])

Create an instance of AMQPConnection.

bool
isConnected()

Check whether the connection to the AMQP broker is still valid.

bool
isPersistent()

Whether connection persistent.

void
connect()

Establish a transient connection with the AMQP broker.

void
disconnect()

Closes the transient 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.

void
pdisconnect()

Closes a 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

Sets the interval of time to wait for income activity from AMQP broker

float
getTimeout() 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.

int
getMaxFrameSize()

Get max supported frame size per connection in bytes.

int
getHeartbeatInterval()

Get number of seconds between heartbeats of the connection in seconds.

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

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

)

Parameters

array $credentials

Optional array of credential information for connecting to the AMQP broker.

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.

Return Value

bool

TRUE if connected, FALSE otherwise.

bool isPersistent()

Whether connection persistent.

When no connection is established, it will always return FALSE. The same disclaimer as for {\AMQPConnection::isConnected()} applies.

Return Value

bool

TRUE if persistently connected, FALSE otherwise.

void connect()

Establish a transient connection with the AMQP broker.

This method will initiate a connection with the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void disconnect()

Closes the transient connection with the AMQP broker.

This method will close an open connection with the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void reconnect()

Close any open transient connections and initiate a new one with the AMQP broker.

Return Value

void

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.

Return Value

void

Exceptions

AMQPConnectionException

void pdisconnect()

Closes a persistent connection with the AMQP broker.

This method will close an open persistent connection with the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void preconnect()

Close any open persistent connections and initiate a new one with the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

string getHost()

Get the configured host.

Return Value

string

The configured hostname of the broker

string getLogin()

Get the configured login.

Return Value

string

The configured login as a string.

string getPassword()

Get the configured password.

Return Value

string

The configured password as a string.

int getPort()

Get the configured port.

Return Value

int

The configured port as an integer.

string getVhost()

Get the configured vhost.

Return Value

string

The configured virtual host as a string.

void setHost(string $host)

Set the hostname used to connect to the AMQP broker.

Parameters

string $host

The hostname of the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void setLogin(string $login)

Set the login string used to connect to the AMQP broker.

Parameters

string $login

The login string used to authenticate with the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void setPassword(string $password)

Set the password string used to connect to the AMQP broker.

Parameters

string $password

The password string used to authenticate with the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void setPort(int $port)

Set the port used to connect to the AMQP broker.

Parameters

int $port

The port used to connect to the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void setVhost(string $vhost)

Sets the virtual host to which to connect on the AMQP broker.

Parameters

string $vhost

The virtual host to use on the AMQP broker.

Return Value

void

Exceptions

AMQPConnectionException

void setTimeout(float $timeout) deprecated

deprecated use AMQPConnection::setReadTimeout($timeout) instead

Sets the interval of time to wait for income activity from AMQP broker

Parameters

float $timeout

Return Value

void

Exceptions

AMQPConnectionException

float getTimeout() deprecated

deprecated use AMQPConnection::getReadTimeout() instead

Get the configured interval of time to wait for income activity from AMQP broker

Return Value

float

void setReadTimeout(float $timeout)

Sets the interval of time to wait for income activity from AMQP broker

Parameters

float $timeout

Return Value

void

Exceptions

AMQPConnectionException

float getReadTimeout()

Get the configured interval of time to wait for income activity from AMQP broker

Return Value

float

void setWriteTimeout(float $timeout)

Sets the interval of time to wait for outcome activity to AMQP broker

Parameters

float $timeout

Return Value

void

Exceptions

AMQPConnectionException

float getWriteTimeout()

Get the configured interval of time to wait for outcome activity to AMQP broker

Return Value

float

float getConnectTimeout()

Get the configured timeout (in seconds) for connecting to the AMQP broker

Return Value

float

void setRpcTimeout(float $timeout)

Sets the interval of time to wait for RPC activity to AMQP broker

Parameters

float $timeout

Return Value

void

Exceptions

AMQPConnectionException

float getRpcTimeout()

Get the configured interval of time to wait for RPC activity to AMQP broker

Return Value

float

int getUsedChannels()

Return last used channel id during current connection session.

Return Value

int

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.

Return Value

int

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.

Return Value

int

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.

Return Value

int

string|null getCACert()

Get path to the CA cert file in PEM format

Return Value

string|null

void setCACert(string $cacert)

Set path to the CA cert file in PEM format

Parameters

string $cacert

Return Value

void

string|null getCert()

Get path to the client certificate in PEM format

Return Value

string|null

void setCert(string $cert)

Set path to the client certificate in PEM format

Parameters

string $cert

Return Value

void

string|null getKey()

Get path to the client key in PEM format

Return Value

string|null

void setKey(string|null $key)

Set path to the client key in PEM format

Parameters

string|null $key

Return Value

void

bool getVerify()

Get whether peer verification enabled or disabled

Return Value

bool

void setVerify(bool $verify)

Enable or disable peer verification

Parameters

bool $verify

Return Value

void

void setSaslMethod($method)

set authentication method

Parameters

$method

Return Value

void

int getSaslMethod()

Get authentication mechanism configuration

Return Value

int

AMQP_SASL_METHOD_PLAIN | AMQP_SASL_METHOD_EXTERNAL

void setConnectionName(string|null $connectionName)

No description

Parameters

string|null $connectionName

Return Value

void

string|null getConnectionName()

No description

Return Value

string|null