0 follower

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
fromData() Creates a new message instance from the given type and payload data. Yiisoft\Queue\Message\MessageInterface
getData() Returns payload data. Yiisoft\Queue\Message\MessageInterface
getMetadata() Returns message metadata: timings, attempt count, metrics, etc. Keys are always strings. Yiisoft\Queue\Message\MessageInterface
getType() Returns message type. Yiisoft\Queue\Message\MessageInterface
withMetadata() Returns a new instance with the given message metadata. Yiisoft\Queue\Message\MessageInterface

Method Details

Hide inherited methods

fromData() public abstract static method

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

public abstract static self fromData ( string $type, boolean|integer|float|string|array|null $data )
$type string

Message type.

$data 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.

                public static function fromData(string $type, bool|int|float|string|array|null $data): self;

            
getData() public abstract method

Returns payload data.

public abstract boolean|integer|float|string|array|null getData ( )
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 getData(): bool|int|float|string|array|null;

            
getMetadata() public abstract method

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

public abstract array getMetadata ( )
return array

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

                public function getMetadata(): array;

            
getType() public abstract method

Returns message type.

public abstract string getType ( )
return string

Message type.

                public function getType(): string;

            
withMetadata() public abstract method

Returns a new instance with the given message metadata.

public abstract static withMetadata ( array $metadata )
$metadata array

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

                public function withMetadata(array $metadata): static;