0

Final Class Yiisoft\Queue\Redis\Message\Message

InheritanceYiisoft\Queue\Redis\Message\Message
ImplementsYiisoft\Queue\Message\MessageInterface

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $handlerName, boolean|integer|float|string|array|null $payload, array $meta, integer $delay 0 )
$handlerName string
$payload boolean|integer|float|string|array|null
$meta array
$delay integer

                public function __construct(
    private string $handlerName,
    private bool|int|float|string|array|null $payload,
    private array $meta,
    private int $delay = 0, //delay in seconds
) {
    if ($this->delay > 0) {
        $this->meta[DelayEnvelope::META_DELAY_SECONDS] = $delay;
    }
}

            
fromPayload() public static method

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

                public static function fromPayload(string $type, bool|int|float|string|array|null $payload): static
{
    return new self($type, $payload, []);
}

            
getHandlerName() public method

public string getHandlerName ( )

                public function getHandlerName(): string
{
    return $this->handlerName;
}

            
getMeta() public method

public array getMeta ( )

                public function getMeta(): array
{
    return $this->meta;
}

            
getPayload() public method

public bool|int|float|string|array|null getPayload ( )

                public function getPayload(): bool|int|float|string|array|null
{
    return $this->payload;
}

            
getType() public method

public string getType ( )

                public function getType(): string
{
    return $this->handlerName;
}

            
withDelay() public method

public self withDelay ( integer $delay )
$delay integer

                public function withDelay(int $delay): self
{
    $message = clone $this;
    $message->meta[DelayEnvelope::META_DELAY_SECONDS] = $delay;
    return $message;
}

            
withMeta() public method

public static withMeta ( array $meta )
$meta array

                public function withMeta(array $meta): static
{
    $message = clone $this;
    $message->meta = $meta;
    return $message;
}