php-amqplib

AbstractConnection extends AbstractChannel
in package

Table of Contents

PROTOCOL_080  = PhpAmqpLibWireConstants080::VERSION
PROTOCOL_091  = PhpAmqpLibWireConstants091::VERSION
$auto_decode  : bool
$blocked  : bool
If connection is blocked due to the broker running low on resources.
$channel_id  : int|null
$channel_max  : int
$close_on_destruct  : bool
$config  : AMQPConnectionConfig|null
$connection  : null|AbstractConnection
$connection_timeout  : int
$constants  : Constants
$construct_params  : array<string|int, mixed>
$debug  : DebugHelper
$dispatch_reader  : AMQPBufferReader
$frame_max  : int
$frame_queue  : SplQueue|array<string|int, Frame>
Lower level queue for frames
$heartbeat  : int
$input  : null|AMQPIOReader
$insist  : bool
$io  : AbstractIO
$is_connected  : bool
$known_hosts  : string
$last_frame  : float
$locale  : string
$locales  : array<string|int, mixed>
$login_method  : string
$login_response  : null|string
$maxBodySize  : int
$mechanisms  : array<string|int, mixed>
$method_queue  : array<string|int, mixed>
Higher level queue for methods
$methodMap  : MethodMap080|MethodMap091
$msg_property_reader  : AMQPBufferReader
$protocolVersion  : string
$protocolWriter  : Protocol080|Protocol091
$server_properties  : array<string|int, mixed>
$version_major  : int
$version_minor  : int
$vhost  : string
$wait_tune_ok  : bool
$waitHelper  : Wait080|Wait091
$writing  : bool
If a frame is currently being written
$channel_rpc_timeout  : float
Maximum time to wait for channel operations, in seconds
$connection_block_handler  : callable
$connection_unblock_handler  : callable
$prepare_content_cache  : array<string|int, mixed>
Circular buffer to speed up prepare_content().
$prepare_content_cache_max_size  : int
__clone()  : mixed
Cloning will use the old properties to make a new connection to the same server
__construct()  : mixed
__destruct()  : mixed
channel()  : AMQPChannel
Fetches a channel object identified by the numeric channel_id, or create that object if it doesn't already exist.
checkHeartBeat()  : mixed
Check connection heartbeat if enabled.
close()  : mixed|null
Requests a connection close
connectOnConstruct()  : bool
Should the connection be attempted during construction?
create_connection()  : mixed
dispatch()  : mixed
get_free_channel_id()  : int
getChannelId()  : int|null
getConnection()  : AbstractConnection|null
getHeartbeat()  : int
getIO()  : AbstractIO
getLastActivity()  : float|int
getLibraryProperties()  : array<string|int, mixed>
Get the library properties for populating the client protocol information
getMethodQueue()  : array<string|int, mixed>
getProtocolVersion()  : string
getReadTimeout()  : float
getServerProperties()  : array<string|int, mixed>
hasPendingMethods()  : bool
isBlocked()  : bool
Get the connection blocked state.
isConnected()  : bool
Gets the connection status
isWriting()  : bool
Get the io writing state.
prepare_content()  : AMQPWriter
Returns a new AMQPWriter or mutates the provided $pkt
reconnect()  : mixed
Reconnects using the original connection settings.
select()  : int
send_content()  : mixed
set_close_on_destruct()  : mixed
Allows to not close the connection it's useful after the fork when you don't want to close parent process connection
set_connection_block_handler()  : mixed
Sets a handler which is called whenever a connection.block is sent from the server
set_connection_unblock_handler()  : mixed
Sets a handler which is called whenever a connection.block is sent from the server
setBodySizeLimit()  : $this
validate_host()  : mixed
wait()  : mixed
Wait for some expected AMQP methods and dispatch to them.
wait_content()  : AMQPMessage
write()  : mixed
close_input()  : mixed
close_socket()  : mixed
closeChannels()  : mixed
Closes all available channels
closeChannelsIfDisconnected()  : mixed
Closes all available channels if disconnected
connect()  : mixed
Connects to the AMQP server
connection_blocked()  : mixed
Handles connection blocked notifications
connection_close()  : mixed
connection_close_ok()  : mixed
Confirm a connection close
connection_open_ok()  : mixed
Signals that the connection is ready
connection_redirect()  : string
Asks the client to use a different server
connection_secure()  : mixed
Security mechanism challenge
connection_start()  : mixed
Starts connection negotiation
connection_tune()  : mixed
Proposes connection tuning parameters
connection_unblocked()  : mixed
Handles connection unblocked notifications
createMessage()  : AMQPMessage
dispatch_deferred_method()  : mixed
dispatch_to_handler()  : mixed
do_close()  : mixed
maybe_wait_for_content()  : AMQPMessage|null
next_frame()  : Frame
parseMethod()  : Method
prepare_channel_method_frame()  : AMQPWriter
Returns a new AMQPWriter or mutates the provided $pkt
prepare_method_frame()  : AMQPWriter
This is here for performance reasons to batch calls to fwrite from basic.publish
process_deferred_methods()  : array<string|int, mixed>
safeClose()  : mixed
Attempts to close the connection safely
send_channel_method_frame()  : mixed
send_method_frame()  : mixed
setIsConnected()  : mixed
Set the connection status
should_dispatch_method()  : bool
validate_frame()  : void
validate_frame_payload()  : void
validate_method_frame()  : void
wait_channel()  : Frame
Waits for a frame from the server destined for a particular channel.
wait_frame()  : Frame
Waits for a frame from the server
x_close_ok()  : mixed
Confirms a connection close
x_open()  : mixed
x_secure_ok()  : mixed
Security mechanism response
x_start_ok()  : mixed
x_tune_ok()  : mixed
Negotiates connection tuning parameters

Constants

PROTOCOL_080

public mixed PROTOCOL_080 = PhpAmqpLibWireConstants080::VERSION
Tags
deprecated

PROTOCOL_091

public mixed PROTOCOL_091 = PhpAmqpLibWireConstants091::VERSION
Tags
deprecated

Properties

$blocked

If connection is blocked due to the broker running low on resources.

protected bool $blocked = false

$close_on_destruct

protected bool $close_on_destruct = true

Close the connection in destructor

$construct_params

protected array<string|int, mixed> $construct_params

Constructor parameters for clone

$frame_queue

Lower level queue for frames

protected SplQueue|array<string|int, Frame> $frame_queue

$method_queue

Higher level queue for methods

protected array<string|int, mixed> $method_queue = array()

$channel_rpc_timeout

Maximum time to wait for channel operations, in seconds

private float $channel_rpc_timeout

$connection_block_handler

private callable $connection_block_handler

Handles connection blocking from the server

$connection_unblock_handler

private callable $connection_unblock_handler

Handles connection unblocking from the server

$prepare_content_cache

Circular buffer to speed up prepare_content().

private array<string|int, mixed> $prepare_content_cache = array()

Max size limited by $prepare_content_cache_max_size.

Tags
see
prepare_content()

$prepare_content_cache_max_size

private int $prepare_content_cache_max_size = 100

Maximal size of $prepare_content_cache

Methods

__clone()

Cloning will use the old properties to make a new connection to the same server

public __clone() : mixed
Return values
mixed

__construct()

public __construct(string $user, string $password[, string $vhost = '/' ][, bool $insist = false ][, string $login_method = 'AMQPLAIN' ][, null $login_response = null ][, string $locale = 'en_US' ][, AbstractIO $io = null ], int $heartbeat, int|float $connection_timeout[, int|float $channel_rpc_timeout = 0.0 ][, AMQPConnectionConfig|null $config = null ]) : mixed
Parameters
$user : string
$password : string
$vhost : string = '/'
$insist : bool = false
$login_method : string = 'AMQPLAIN'
$login_response : null = null

@deprecated

$locale : string = 'en_US'
$io : AbstractIO = null
$heartbeat : int
$connection_timeout : int|float
$channel_rpc_timeout : int|float = 0.0
$config : AMQPConnectionConfig|null = null
Tags
throws
Exception
Return values
mixed

checkHeartBeat()

Check connection heartbeat if enabled.

public checkHeartBeat() : mixed
Tags
throws
AMQPHeartbeatMissedException

If too much time passed since last connection activity.

throws
AMQPConnectionClosedException

If connection was closed due to network issues or timeouts.

throws
AMQPSocketException

If connection was already closed.

throws
AMQPTimeoutException

If heartbeat write takes too much time.

throws
AMQPIOException

If other connection problems occurred.

Return values
mixed

close()

Requests a connection close

public close(int $reply_code[, string $reply_text = '' ][, array<string|int, mixed> $method_sig = array(0, 0) ]) : mixed|null
Parameters
$reply_code : int
$reply_text : string = ''
$method_sig : array<string|int, mixed> = array(0, 0)
Tags
throws
Exception
Return values
mixed|null

connectOnConstruct()

Should the connection be attempted during construction?

public connectOnConstruct() : bool
Return values
bool

create_connection()

public static create_connection(array<string|int, mixed> $hosts[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$hosts : array<string|int, mixed>
$options : array<string|int, mixed> = array()
Tags
throws
Exception
deprecated

Use AMQPConnectionFactory.

Return values
mixed

getChannelId()

public getChannelId() : int|null
Return values
int|null

getLastActivity()

public getLastActivity() : float|int
Return values
float|int

getLibraryProperties()

Get the library properties for populating the client protocol information

public getLibraryProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMethodQueue()

public getMethodQueue() : array<string|int, mixed>
Return values
array<string|int, mixed>

getReadTimeout()

public getReadTimeout() : float
Tags
since
3.2.0
Return values
float

getServerProperties()

public getServerProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasPendingMethods()

public hasPendingMethods() : bool
Return values
bool

isBlocked()

Get the connection blocked state.

public isBlocked() : bool
Tags
since
2.12.0
Return values
bool

isConnected()

Gets the connection status

public isConnected() : bool
Return values
bool

isWriting()

Get the io writing state.

public isWriting() : bool
Return values
bool

prepare_content()

Returns a new AMQPWriter or mutates the provided $pkt

public prepare_content(int $channel, int $class_id, int $weight, int $body_size, string $packed_properties, string $body, AMQPWriter|null $pkt) : AMQPWriter
Parameters
$channel : int
$class_id : int
$weight : int
$body_size : int
$packed_properties : string
$body : string
$pkt : AMQPWriter|null
Return values
AMQPWriter

reconnect()

Reconnects using the original connection settings.

public reconnect() : mixed

This will not recreate any channels that were established previously

Tags
throws
Exception
Return values
mixed

send_content()

public send_content(int $channel, int $class_id, int $weight, int $body_size, string $packed_properties, string $body, AMQPWriter $pkt) : mixed
Parameters
$channel : int
$class_id : int
$weight : int
$body_size : int
$packed_properties : string
$body : string
$pkt : AMQPWriter
Tags
throws
AMQPIOException
Return values
mixed

set_close_on_destruct()

Allows to not close the connection it's useful after the fork when you don't want to close parent process connection

public set_close_on_destruct([bool $close = true ]) : mixed
Parameters
$close : bool = true
Return values
mixed

set_connection_block_handler()

Sets a handler which is called whenever a connection.block is sent from the server

public set_connection_block_handler(callable $callback) : mixed
Parameters
$callback : callable
Tags
throws
InvalidArgumentException

if $callback is not callable

Return values
mixed

set_connection_unblock_handler()

Sets a handler which is called whenever a connection.block is sent from the server

public set_connection_unblock_handler(callable $callback) : mixed
Parameters
$callback : callable
Tags
throws
InvalidArgumentException

if $callback is not callable

Return values
mixed

setBodySizeLimit()

public setBodySizeLimit(int $max_bytes) : $this
Parameters
$max_bytes : int

Max message body size for this channel

Return values
$this

validate_host()

public static validate_host(mixed $host) : mixed
Parameters
$host : mixed
Return values
mixed

wait()

Wait for some expected AMQP methods and dispatch to them.

public wait([array<string|int, mixed>|null $allowed_methods = null ][, bool $non_blocking = false ], int|float|null $timeout) : mixed

Unexpected methods are queued up for later calls to this PHP method.

Parameters
$allowed_methods : array<string|int, mixed>|null = null
$non_blocking : bool = false
$timeout : int|float|null
Tags
throws
AMQPRuntimeException
throws
AMQPTimeoutException
throws
AMQPConnectionClosedException
throws
AMQPOutOfBoundsException
Return values
mixed

closeChannels()

Closes all available channels

protected closeChannels() : mixed
Return values
mixed

closeChannelsIfDisconnected()

Closes all available channels if disconnected

protected closeChannelsIfDisconnected() : mixed
Return values
mixed

connect()

Connects to the AMQP server

protected connect() : mixed
Tags
throws
Exception
Return values
mixed

connection_close_ok()

Confirm a connection close

protected connection_close_ok() : mixed
Return values
mixed

connection_unblocked()

Handles connection unblocked notifications

protected connection_unblocked() : mixed
Return values
mixed

dispatch_deferred_method()

protected dispatch_deferred_method(array<string|int, mixed> $queued_method) : mixed
Parameters
$queued_method : array<string|int, mixed>
Return values
mixed

dispatch_to_handler()

protected dispatch_to_handler(callable $handler[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
$handler : callable
$arguments : array<string|int, mixed> = []
Return values
mixed

next_frame()

protected next_frame(int|float|null $timeout) : Frame
Parameters
$timeout : int|float|null
Return values
Frame

prepare_channel_method_frame()

Returns a new AMQPWriter or mutates the provided $pkt

protected prepare_channel_method_frame(int $channel, array<string|int, mixed> $method_sig[, AMQPWriter|string $args = '' ][, AMQPWriter|null $pkt = null ]) : AMQPWriter
Parameters
$channel : int
$method_sig : array<string|int, mixed>
$args : AMQPWriter|string = ''
$pkt : AMQPWriter|null = null
Return values
AMQPWriter

prepare_method_frame()

This is here for performance reasons to batch calls to fwrite from basic.publish

protected prepare_method_frame(array<string|int, mixed> $method_sig[, AMQPWriter|string $args = '' ][, AMQPWriter $pkt = null ]) : AMQPWriter
Parameters
$method_sig : array<string|int, mixed>
$args : AMQPWriter|string = ''
$pkt : AMQPWriter = null
Return values
AMQPWriter

process_deferred_methods()

protected process_deferred_methods(array<string|int, mixed>|null $allowed_methods) : array<string|int, mixed>
Parameters
$allowed_methods : array<string|int, mixed>|null
Return values
array<string|int, mixed>

safeClose()

Attempts to close the connection safely

protected safeClose() : mixed
Return values
mixed

send_channel_method_frame()

protected send_channel_method_frame(int $channel, array<string|int, mixed> $method_sig[, AMQPWriter|string $args = '' ][, null $pkt = null ]) : mixed
Parameters
$channel : int
$method_sig : array<string|int, mixed>
$args : AMQPWriter|string = ''
$pkt : null = null
Tags
throws
AMQPIOException
Return values
mixed

send_method_frame()

protected send_method_frame(array<string|int, mixed> $method_sig[, AMQPWriter|string $args = '' ]) : mixed
Parameters
$method_sig : array<string|int, mixed>
$args : AMQPWriter|string = ''
Return values
mixed

setIsConnected()

Set the connection status

protected setIsConnected(bool $is_connected) : mixed
Parameters
$is_connected : bool
Return values
mixed

should_dispatch_method()

protected should_dispatch_method(array<string|int, mixed>|null $allowed_methods, string $method_sig) : bool
Parameters
$allowed_methods : array<string|int, mixed>|null
$method_sig : string
Return values
bool

wait_channel()

Waits for a frame from the server destined for a particular channel.

protected wait_channel(int $channel_id, int|float|null $timeout) : Frame
Parameters
$channel_id : int
$timeout : int|float|null
Tags
throws
Exception
Return values
Frame

x_close_ok()

Confirms a connection close

protected x_close_ok() : mixed
Return values
mixed

x_open()

protected x_open(string $virtual_host[, string $capabilities = '' ][, bool $insist = false ]) : mixed
Parameters
$virtual_host : string
$capabilities : string = ''
$insist : bool = false
Return values
mixed

x_secure_ok()

Security mechanism response

protected x_secure_ok(string $response) : mixed
Parameters
$response : string
Return values
mixed

x_start_ok()

protected x_start_ok(AMQPTable|array<string|int, mixed> $clientProperties, string $mechanism, string $response, string $locale) : mixed
Parameters
$clientProperties : AMQPTable|array<string|int, mixed>
$mechanism : string
$response : string
$locale : string
Return values
mixed

x_tune_ok()

Negotiates connection tuning parameters

protected x_tune_ok(int $channel_max, int $frame_max, int $heartbeat) : mixed
Parameters
$channel_max : int
$frame_max : int
$heartbeat : int
Return values
mixed

Search results