AMQPConnection::__construct

(PECL amqp >= Unknown)

AMQPConnection::__constructCreate an instance of AMQPConnection

Beskrivelse

public AMQPConnection::__construct ([ array $credentials = array() ] )

Creates an AMQPConnection instance representing a connection to an AMQP broker.

Parametre

credentials

The credentials is an optional array of credential information for connecting to the AMQP broker.

Supported indexes
key Description Default value
host The host to connect too

Note: Max 1024 characters

amqp.host
port Port on the host amqp.port
vhost The virtual host on the host

Note: Max 128 characters

amqp.vhost
login The login name to use.

Note: Max 128 characters

amqp.login
password Password

Note: Max 128 characters

amqp.password

All other keys will be ignored.

Returnerings Værdier

An AMQPConnection object.

Fejl/Undtagelser

Throws AMQPException exception on parameter parsing failures, and option errors.

Eksempler

Eksempel #1 AMQPConnection::__construct() example

<?php

/* Create a connection using the INI values */
$connection1 = new AMQPConnection();

/* Specifying all keys */
$connection2 = new AMQPConnection(array(
    
'host' => 'example.host',
    
'vhost' => '/',
    
'port' => 5763,
    
'login' => 'user',
    
'password' => 'password'
));

?>

Noter

Note:

A connection will not be established until AMQPConnection::connect() is called.

add a note add a note

User Contributed Notes 1 note

up
0
1770070928 at qq dot com
3 years ago
/* Create a connection using the INI values */
$connection1 = new AMQPConnection();

/* Specifying all keys */
$connection2 = new AMQPConnection(array(
    'host' => 'example.host',
    'vhost' => '/',
    'port' => 5763,
    'login' => 'user',
    'password' => 'password',
    'read_timeout'=>2,
    'connect_timeout'=>3,
    'write_timeout'=>3
));
To Top