AMQPMessage
in package
A Message for use with the Channnel.basic_* methods.
Table of Contents
- DELIVERY_MODE_NON_PERSISTENT = 1
- DELIVERY_MODE_PERSISTENT = 2
- $body : string
- $body_size : int
- $content_encoding : string
- $is_truncated : bool
- $properties : array<string|int, mixed>
- $propertyDefinitions : array<string|int, mixed>
- $serialized_properties : null|string
- $channel : AMQPChannel|null
- $consumerTag : string|null
- $deliveryTag : int
- $exchange : string|null
- $messageCount : int|null
- $redelivered : bool|null
- $responded : bool
- $routingKey : string|null
- __construct() : mixed
- ack() : mixed
- Acknowledge one or more messages.
- get() : mixed|AMQPChannel
- Look for additional properties in the 'properties' dictionary, and if present - the 'delivery_info' dictionary.
- get_properties() : array<string|int, mixed>
- Returns the properties content
- getBody() : string
- getBodySize() : int
- getChannel() : AMQPChannel|null
- getConsumerTag() : string|null
- getContentEncoding() : string
- getDeliveryTag() : int
- getExchange() : string|null
- getMessageCount() : int|null
- getRoutingKey() : string|null
- has() : bool
- Check whether a property exists in the 'properties' dictionary or if present - in the 'delivery_info' dictionary.
- isRedelivered() : bool|null
- isTruncated() : bool
- load_properties() : $this
- Given the raw bytes containing the property-flags and property-list from a content-frame-header, parse and insert into a dictionary stored in this object as an attribute named 'properties'.
- nack() : mixed
- Reject one or more incoming messages.
- reject() : mixed
- Reject an incoming message.
- serialize_properties() : string
- Serializes the 'properties' attribute (a dictionary) into the raw bytes making up a set of property flags and a property list, suitable for putting into a content frame header.
- set() : mixed
- Sets a property value
- setBody() : $this
- Sets the message payload
- setBodySize() : AMQPMessage
- setChannel() : $this
- setConsumerTag() : $this
- setDeliveryInfo() : $this
- setDeliveryTag() : $this
- setIsTruncated() : AMQPMessage
- setMessageCount() : $this
- assertUnacked() : mixed
- onResponse() : mixed
Constants
DELIVERY_MODE_NON_PERSISTENT
public
mixed
DELIVERY_MODE_NON_PERSISTENT
= 1
DELIVERY_MODE_PERSISTENT
public
mixed
DELIVERY_MODE_PERSISTENT
= 2
Properties
$body
public
string
$body
Tags
$body_size
public
int
$body_size
Tags
$content_encoding
public
string
$content_encoding
Tags
$is_truncated
public
bool
$is_truncated
= false
Tags
$properties
protected
array<string|int, mixed>
$properties
= array()
Properties content
$propertyDefinitions
protected
static array<string|int, mixed>
$propertyDefinitions
= array('content_type' => 'shortstr', 'content_encoding' => 'shortstr', 'application_headers' => 'table_object', 'delivery_mode' => 'octet', 'priority' => 'octet', 'correlation_id' => 'shortstr', 'reply_to' => 'shortstr', 'expiration' => 'shortstr', 'message_id' => 'shortstr', 'timestamp' => 'timestamp', 'type' => 'shortstr', 'user_id' => 'shortstr', 'app_id' => 'shortstr', 'cluster_id' => 'shortstr')
$serialized_properties
protected
null|string
$serialized_properties
Compiled properties
$channel
private
AMQPChannel|null
$channel
$consumerTag
private
string|null
$consumerTag
$deliveryTag
private
int
$deliveryTag
$exchange
private
string|null
$exchange
$messageCount
private
int|null
$messageCount
$redelivered
private
bool|null
$redelivered
$responded
private
bool
$responded
= false
$routingKey
private
string|null
$routingKey
Methods
__construct()
public
__construct([string $body = '' ][, array<string|int, mixed> $properties = array() ]) : mixed
Parameters
- $body : string = ''
- $properties : array<string|int, mixed> = array()
Return values
mixed —ack()
Acknowledge one or more messages.
public
ack([bool $multiple = false ]) : mixed
Parameters
- $multiple : bool = false
-
If true, the delivery tag is treated as "up to and including", so that multiple messages can be acknowledged with a single method.
Tags
Return values
mixed —get()
Look for additional properties in the 'properties' dictionary, and if present - the 'delivery_info' dictionary.
public
get(string $name) : mixed|AMQPChannel
Parameters
- $name : string
Tags
Return values
mixed|AMQPChannel —get_properties()
Returns the properties content
public
get_properties() : array<string|int, mixed>
Return values
array<string|int, mixed> —getBody()
public
getBody() : string
Return values
string —getBodySize()
public
getBodySize() : int
Return values
int —getChannel()
public
getChannel() : AMQPChannel|null
Tags
Return values
AMQPChannel|null —getConsumerTag()
public
getConsumerTag() : string|null
Tags
Return values
string|null —getContentEncoding()
public
getContentEncoding() : string
Return values
string —getDeliveryTag()
public
getDeliveryTag() : int
Tags
Return values
int —getExchange()
public
getExchange() : string|null
Tags
Return values
string|null —getMessageCount()
public
getMessageCount() : int|null
Tags
Return values
int|null —getRoutingKey()
public
getRoutingKey() : string|null
Tags
Return values
string|null —has()
Check whether a property exists in the 'properties' dictionary or if present - in the 'delivery_info' dictionary.
public
has(string $name) : bool
Parameters
- $name : string
Return values
bool —isRedelivered()
public
isRedelivered() : bool|null
Tags
Return values
bool|null —isTruncated()
public
isTruncated() : bool
Return values
bool —load_properties()
Given the raw bytes containing the property-flags and property-list from a content-frame-header, parse and insert into a dictionary stored in this object as an attribute named 'properties'.
public
load_properties(AMQPReader $reader) : $this
Parameters
- $reader : AMQPReader
-
NOTE: do not mutate $reader
Return values
$this —nack()
Reject one or more incoming messages.
public
nack([bool $requeue = false ][, bool $multiple = false ]) : mixed
Parameters
- $requeue : bool = false
-
If true, the server will attempt to requeue the message. If requeue is false or the requeue attempt fails the messages are discarded or dead-lettered.
- $multiple : bool = false
-
If true, the delivery tag is treated as "up to and including", so that multiple messages can be rejected with a single method.
Tags
Return values
mixed —reject()
Reject an incoming message.
public
reject([bool $requeue = true ]) : mixed
Parameters
- $requeue : bool = true
-
If requeue is true, the server will attempt to requeue the message. If requeue is false or the requeue attempt fails the messages are discarded or dead-lettered.
Tags
Return values
mixed —serialize_properties()
Serializes the 'properties' attribute (a dictionary) into the raw bytes making up a set of property flags and a property list, suitable for putting into a content frame header.
public
serialize_properties() : string
Tags
Return values
string —set()
Sets a property value
public
set(string $name, mixed $value) : mixed
Parameters
- $name : string
-
The property name (one of the property definition)
- $value : mixed
-
The property value
Tags
Return values
mixed —setBody()
Sets the message payload
public
setBody(string $body) : $this
Parameters
- $body : string
Return values
$this —setBodySize()
public
setBodySize(int $body_size) : AMQPMessage
Parameters
- $body_size : int
-
Message body size in byte(s)
Return values
AMQPMessage —setChannel()
public
setChannel(AMQPChannel $channel) : $this
Parameters
- $channel : AMQPChannel
Tags
Return values
$this —setConsumerTag()
public
setConsumerTag(string $consumerTag) : $this
Parameters
- $consumerTag : string
Tags
Return values
$this —setDeliveryInfo()
public
setDeliveryInfo(int $deliveryTag, bool $redelivered, string $exchange, string $routingKey) : $this
Parameters
- $deliveryTag : int
- $redelivered : bool
- $exchange : string
- $routingKey : string
Tags
Return values
$this —setDeliveryTag()
public
setDeliveryTag(int|string $deliveryTag) : $this
Parameters
- $deliveryTag : int|string
Tags
Return values
$this —setIsTruncated()
public
setIsTruncated(bool $is_truncated) : AMQPMessage
Parameters
- $is_truncated : bool
Return values
AMQPMessage —setMessageCount()
public
setMessageCount(int $messageCount) : $this
Parameters
- $messageCount : int
Tags
Return values
$this —assertUnacked()
protected
assertUnacked() : mixed
Tags
Return values
mixed —onResponse()
protected
onResponse() : mixed