0

Interface Yiisoft\Queue\Message\MessageInterface

Implemented byYiisoft\Queue\Message\DelayEnvelope, Yiisoft\Queue\Message\Envelope, Yiisoft\Queue\Message\GenericMessage, Yiisoft\Queue\Message\IdEnvelope, Yiisoft\Queue\Message\Message, Yiisoft\Queue\Middleware\FailureHandling\FailureEnvelope, Yiisoft\Queue\Stubs\DummyEnvelope

Represents a queue message with a type identifier, payload data, and metadata.

Public Methods

Hide inherited methods

Method Description Defined By
fromPayload() Creates a new message instance from the given type and payload data. Yiisoft\Queue\Message\MessageInterface
getMeta() Returns message metadata: timings, attempt count, metrics, etc. Keys are always strings. Yiisoft\Queue\Message\MessageInterface
getPayload() Returns payload data. Yiisoft\Queue\Message\MessageInterface
getType() Returns message type. Yiisoft\Queue\Message\MessageInterface
withMeta() Returns a new instance with the given message metadata. Yiisoft\Queue\Message\MessageInterface

Method Details

Hide inherited methods

fromPayload() public abstract static method

Creates a new message instance from the given type and payload data.

public abstract static static fromPayload ( string $type, boolean|integer|float|string|array|null $payload )
$type string

Message type.

$payload boolean|integer|float|string|array|null

Message payload data. Must contain only null, scalars (bool, int, float, string), or arrays composed of the same types recursively.

return static

Instance of the called class with the given type and payload.

                public static function fromPayload(string $type, bool|int|float|string|array|null $payload): static;

            
getMeta() public abstract method

Returns message metadata: timings, attempt count, metrics, etc. Keys are always strings.

public abstract array getMeta ( )
return array

Metadata containing only null, scalars (bool, int, float, string), or arrays composed of the same types recursively.

                public function getMeta(): array;

            
getPayload() public abstract method

Returns payload data.

public abstract boolean|integer|float|string|array|null getPayload ( )
return boolean|integer|float|string|array|null

Payload data containing only null, scalars (bool, int, float, string), or arrays composed of the same types recursively.

                public function getPayload(): bool|int|float|string|array|null;

            
getType() public abstract method

Returns message type.

public abstract string getType ( )
return string

Message type.

                public function getType(): string;

            
withMeta() public abstract method

Returns a new instance with the given message metadata.

public abstract static withMeta ( array $meta )
$meta array

Metadata containing only null, scalars (bool, int, float, string), or arrays composed of the same types recursively.

return static

New instance with the given metadata.

                public function withMeta(array $meta): static;