PublishedMessage
extends PendingMessage
in package
A simple DTO for published messages which need to be stored in a repository while waiting for the confirmation to be deliverable.
Table of Contents
- $lastSentAt : DateTime
- $message : string
- $messageId : int
- $qualityOfService : int
- $received : bool
- $retain : bool
- $sendingAttempts : int
- $topicName : string
- __construct() : mixed
- Creates a new published message object.
- getLastSentAt() : DateTime
- Returns the date time when the message was last sent.
- getMessage() : string
- Returns the content of the published message.
- getMessageId() : int
- Returns the message identifier.
- getQualityOfServiceLevel() : int
- Returns the requested quality of service level.
- getSendingAttempts() : int
- Returns the number of times the message has been sent.
- getTopicName() : string
- Returns the topic name of the published message.
- hasBeenReceived() : bool
- Determines whether the message has been confirmed as received.
- incrementSendingAttempts() : static
- Increments the sending attempts by one.
- markAsReceived() : bool
- Marks the published message as received (QoS level 2).
- setLastSentAt() : static
- Sets the date time when the message was last sent.
- wantsToBeRetained() : bool
- Determines whether this message wants to be retained.
Properties
$lastSentAt
private
DateTime
$lastSentAt
$message
private
string
$message
$messageId
private
int
$messageId
$qualityOfService
private
int
$qualityOfService
$received
private
bool
$received
= false
$retain
private
bool
$retain
$sendingAttempts
private
int
$sendingAttempts
= 1
$topicName
private
string
$topicName
Methods
__construct()
Creates a new published message object.
public
__construct(int $messageId, string $topicName, string $message, int $qualityOfService, bool $retain) : mixed
Parameters
- $messageId : int
- $topicName : string
- $message : string
- $qualityOfService : int
- $retain : bool
Return values
mixed —getLastSentAt()
Returns the date time when the message was last sent.
public
getLastSentAt() : DateTime
Return values
DateTime —getMessage()
Returns the content of the published message.
public
getMessage() : string
Return values
string —getMessageId()
Returns the message identifier.
public
getMessageId() : int
Return values
int —getQualityOfServiceLevel()
Returns the requested quality of service level.
public
getQualityOfServiceLevel() : int
Return values
int —getSendingAttempts()
Returns the number of times the message has been sent.
public
getSendingAttempts() : int
Return values
int —getTopicName()
Returns the topic name of the published message.
public
getTopicName() : string
Return values
string —hasBeenReceived()
Determines whether the message has been confirmed as received.
public
hasBeenReceived() : bool
Return values
bool —incrementSendingAttempts()
Increments the sending attempts by one.
public
incrementSendingAttempts() : static
Return values
static —markAsReceived()
Marks the published message as received (QoS level 2).
public
markAsReceived() : bool
Returns true
if the message was not previously received. Otherwise
false
will be returned.
Return values
bool —setLastSentAt()
Sets the date time when the message was last sent.
public
setLastSentAt([DateTime|null $value = null ]) : static
Parameters
- $value : DateTime|null = null
Return values
static —wantsToBeRetained()
Determines whether this message wants to be retained.
public
wantsToBeRetained() : bool