Abstract Class Yiisoft\Queue\Message\Envelope
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $meta | array | Yiisoft\ |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| fromMessage() | Creates an envelope for the given message, restoring the envelope's own parameters from the message metadata. | Yiisoft\ |
| fromPayload() | Envelopes cannot be created from a raw payload. Use {@see fromMessage()} to wrap an existing message instead. | Yiisoft\ |
| getMessage() | Yiisoft\ |
|
| getMeta() | Yiisoft\ |
|
| getPayload() | Yiisoft\ |
|
| getType() | Yiisoft\ |
|
| withMeta() | Yiisoft\ |
Property Details
Method Details
| public mixed __construct ( Yiisoft\ | ||
| $message | Yiisoft\ |
|
| $meta | array | |
public function __construct(MessageInterface $message, array $meta)
{
/** @var TMeta */
$this->meta = array_merge($message->getMeta(), $meta);
while ($message instanceof self) {
$message = $message->getMessage();
}
$this->message = $message;
}
Creates an envelope for the given message, restoring the envelope's own parameters from the message metadata.
| public abstract static static fromMessage ( Yiisoft\ | ||
| $message | Yiisoft\ |
The message to create an envelope for. |
abstract public static function fromMessage(MessageInterface $message): static;
Envelopes cannot be created from a raw payload. Use {@see fromMessage()} to wrap an existing message instead.
| public static static fromPayload ( string $type, mixed $payload ) | ||
| $type | string | |
| $payload | mixed | |
| throws | LogicException |
Always, since this method is not supported for envelopes. |
|---|---|---|
final public static function fromPayload(string $type, mixed $payload): static
{
throw new LogicException(
'Envelopes cannot be created via "fromPayload()". Wrap an existing "MessageInterface" instance instead.',
);
}
| public Yiisoft\ |
final public function getMessage(): MessageInterface
{
return $this->message;
}
| public bool|int|float|string|array|null getPayload ( ) |
final public function getPayload(): bool|int|float|string|array|null
{
return $this->message->getPayload();
}
| public string getType ( ) |
final public function getType(): string
{
return $this->message->getType();
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.