AMQPStreamConnection
extends AbstractConnection
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
- try_create_connection() : mixed
- 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
PROTOCOL_091
public
mixed
PROTOCOL_091
= PhpAmqpLibWireConstants091::VERSION
Tags
Properties
$auto_decode
protected
bool
$auto_decode
= false
$blocked
If connection is blocked due to the broker running low on resources.
protected
bool
$blocked
= false
$channel_id
protected
int|null
$channel_id
$channel_max
protected
int
$channel_max
= 65535
$close_on_destruct
protected
bool
$close_on_destruct
= true
Close the connection in destructor
$config
protected
AMQPConnectionConfig|null
$config
$connection
protected
null|AbstractConnection
$connection
$connection_timeout
protected
int
$connection_timeout
Connection timeout value
$constants
protected
Constants
$constants
$construct_params
protected
array<string|int, mixed>
$construct_params
Constructor parameters for clone
$debug
protected
DebugHelper
$debug
$dispatch_reader
protected
AMQPBufferReader
$dispatch_reader
$frame_max
protected
int
$frame_max
= 131072
$frame_queue
Lower level queue for frames
protected
SplQueue|array<string|int, Frame>
$frame_queue
$heartbeat
protected
int
$heartbeat
$input
protected
null|AMQPIOReader
$input
$insist
protected
bool
$insist
$io
protected
AbstractIO
$io
$is_connected
protected
bool
$is_connected
= false
Maintain connection status
$known_hosts
protected
string
$known_hosts
$last_frame
protected
float
$last_frame
$locale
protected
string
$locale
$locales
protected
array<string|int, mixed>
$locales
$login_method
protected
string
$login_method
$login_response
protected
null|string
$login_response
$maxBodySize
protected
int
$maxBodySize
$mechanisms
protected
array<string|int, mixed>
$mechanisms
$method_queue
Higher level queue for methods
protected
array<string|int, mixed>
$method_queue
= array()
$methodMap
protected
MethodMap080|MethodMap091
$methodMap
$msg_property_reader
protected
AMQPBufferReader
$msg_property_reader
$protocolVersion
protected
string
$protocolVersion
Tags
$protocolWriter
protected
Protocol080|Protocol091
$protocolWriter
$server_properties
protected
array<string|int, mixed>
$server_properties
$version_major
protected
int
$version_major
$version_minor
protected
int
$version_minor
$vhost
protected
string
$vhost
$wait_tune_ok
protected
bool
$wait_tune_ok
$waitHelper
protected
Wait080|Wait091
$waitHelper
$writing
If a frame is currently being written
protected
bool
$writing
= false
$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
$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 $host, int $port, string $user, string $password[, string $vhost = '/' ][, bool $insist = false ][, string $login_method = 'AMQPLAIN' ][, null $login_response = null ][, string $locale = 'en_US' ][, float $connection_timeout = 3.0 ][, float $read_write_timeout = 3.0 ][, resource|array<string|int, mixed>|null $context = null ][, bool $keepalive = false ], int $heartbeat[, float $channel_rpc_timeout = 0.0 ][, string|AMQPConnectionConfig|null $ssl_protocol = null ][, AMQPConnectionConfig|null $config = null ]) : mixed
Parameters
- $host : string
- $port : int
- $user : string
- $password : string
- $vhost : string = '/'
- $insist : bool = false
- $login_method : string = 'AMQPLAIN'
- $login_response : null = null
-
@deprecated
- $locale : string = 'en_US'
- $connection_timeout : float = 3.0
- $read_write_timeout : float = 3.0
- $context : resource|array<string|int, mixed>|null = null
- $keepalive : bool = false
- $heartbeat : int
- $channel_rpc_timeout : float = 0.0
- $ssl_protocol : string|AMQPConnectionConfig|null = null
-
@deprecated
- $config : AMQPConnectionConfig|null = null
Tags
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —channel()
Fetches a channel object identified by the numeric channel_id, or create that object if it doesn't already exist.
public
channel([int|null $channel_id = null ]) : AMQPChannel
Parameters
- $channel_id : int|null = null
Tags
Return values
AMQPChannel —checkHeartBeat()
Check connection heartbeat if enabled.
public
checkHeartBeat() : mixed
Tags
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
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
Return values
mixed —dispatch()
public
dispatch(string $method_sig, string $args, AMQPMessage|null $amqpMessage) : mixed
Parameters
- $method_sig : string
- $args : string
- $amqpMessage : AMQPMessage|null
Tags
Return values
mixed —get_free_channel_id()
public
get_free_channel_id() : int
Tags
Return values
int —getChannelId()
public
getChannelId() : int|null
Return values
int|null —getConnection()
public
getConnection() : AbstractConnection|null
Return values
AbstractConnection|null —getHeartbeat()
public
getHeartbeat() : int
Return values
int —getIO()
public
getIO() : AbstractIO
Tags
Return values
AbstractIO —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> —getProtocolVersion()
public
static getProtocolVersion() : string
Tags
Return values
string —getReadTimeout()
public
getReadTimeout() : float
Tags
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
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
Return values
mixed —select()
public
select(int|null $sec, int $usec) : int
Parameters
- $sec : int|null
- $usec : int
Tags
Return values
int —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
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
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
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
Return values
mixed —wait_content()
public
wait_content() : AMQPMessage
Tags
Return values
AMQPMessage —write()
public
write(string $data) : mixed
Parameters
- $data : string
Tags
Return values
mixed —close_input()
protected
close_input() : mixed
Return values
mixed —close_socket()
protected
close_socket() : mixed
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
Return values
mixed —connection_blocked()
Handles connection blocked notifications
protected
connection_blocked(AMQPReader $args) : mixed
Parameters
- $args : AMQPReader
Return values
mixed —connection_close()
protected
connection_close(AMQPReader $reader) : mixed
Parameters
- $reader : AMQPReader
Tags
Return values
mixed —connection_close_ok()
Confirm a connection close
protected
connection_close_ok() : mixed
Return values
mixed —connection_open_ok()
Signals that the connection is ready
protected
connection_open_ok(AMQPReader $args) : mixed
Parameters
- $args : AMQPReader
Return values
mixed —connection_redirect()
Asks the client to use a different server
protected
connection_redirect(AMQPReader $args) : string
Parameters
- $args : AMQPReader
Return values
string —connection_secure()
Security mechanism challenge
protected
connection_secure(AMQPReader $args) : mixed
Parameters
- $args : AMQPReader
Return values
mixed —connection_start()
Starts connection negotiation
protected
connection_start(AMQPReader $args) : mixed
Parameters
- $args : AMQPReader
Return values
mixed —connection_tune()
Proposes connection tuning parameters
protected
connection_tune(AMQPReader $args) : mixed
Parameters
- $args : AMQPReader
Return values
mixed —connection_unblocked()
Handles connection unblocked notifications
protected
connection_unblocked() : mixed
Return values
mixed —createMessage()
protected
createMessage(AMQPReader $propertyReader, int $bodySize) : AMQPMessage
Parameters
- $propertyReader : AMQPReader
- $bodySize : int
Return values
AMQPMessage —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 —do_close()
protected
do_close() : mixed
Return values
mixed —maybe_wait_for_content()
protected
maybe_wait_for_content(string $method_sig) : AMQPMessage|null
Parameters
- $method_sig : string
Return values
AMQPMessage|null —next_frame()
protected
next_frame(int|float|null $timeout) : Frame
Parameters
- $timeout : int|float|null
Return values
Frame —parseMethod()
protected
parseMethod(string $payload) : Method
Parameters
- $payload : string
Return values
Method —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
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 —try_create_connection()
protected
static try_create_connection(mixed $host, mixed $port, mixed $user, mixed $password, mixed $vhost, mixed $options) : mixed
Parameters
- $host : mixed
- $port : mixed
- $user : mixed
- $password : mixed
- $vhost : mixed
- $options : mixed
Tags
Return values
mixed —validate_frame()
protected
validate_frame(Frame $frame, int $expectedType) : void
Parameters
- $frame : Frame
- $expectedType : int
Tags
Return values
void —validate_frame_payload()
protected
validate_frame_payload(Frame $frame) : void
Parameters
- $frame : Frame
Tags
Return values
void —validate_method_frame()
protected
validate_method_frame(Frame $frame) : void
Parameters
- $frame : Frame
Tags
Return values
void —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
Return values
Frame —wait_frame()
Waits for a frame from the server
protected
wait_frame(int|float|null $timeout) : Frame
Parameters
- $timeout : int|float|null
Tags
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