0

Final Class Yiisoft\Queue\Middleware\FailureHandling\FailureEnvelope

InheritanceYiisoft\Queue\Middleware\FailureHandling\FailureEnvelope » Yiisoft\Queue\Message\Envelope
ImplementsYiisoft\Queue\Message\MessageInterface

Protected Properties

Hide inherited properties

Property Type Description Defined By
$meta array Yiisoft\Queue\Message\Envelope

Constants

Hide inherited constants

Constant Value Description Defined By
META_FAILURE 'yii-failure' Yiisoft\Queue\Middleware\FailureHandling\FailureEnvelope

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Queue\Message\MessageInterface $message, array $failureMeta = [] )
$message Yiisoft\Queue\Message\MessageInterface
$failureMeta array

                public function __construct(MessageInterface $message, array $failureMeta = [])
{
    /** @psalm-var FailureMeta */
    $this->failureMeta = $failureMeta === []
        ? self::getFailureMetaFromMessage($message)
        : ArrayHelper::merge(
            self::getFailureMetaFromMessage($message),
            $failureMeta,
        );
    parent::__construct($message, [
        self::META_FAILURE => $this->failureMeta,
    ]);
}

            
fromMessage() public static method

public static static fromMessage ( Yiisoft\Queue\Message\MessageInterface $message )
$message Yiisoft\Queue\Message\MessageInterface

                public static function fromMessage(MessageInterface $message): static
{
    return new self(
        $message,
        self::getFailureMetaFromMessage($message),
    );
}

            
fromPayload() public static method

Defined in: Yiisoft\Queue\Message\Envelope::fromPayload()

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.',
    );
}

            
getFailureMeta() public method

public array getFailureMeta ( )

                public function getFailureMeta(): array
{
    return $this->failureMeta;
}

            
getFailureMetaValue() public method

public mixed getFailureMetaValue ( string $key, mixed $default null )
$key string
$default mixed

                public function getFailureMetaValue(string $key, mixed $default = null): mixed
{
    return $this->failureMeta[$key] ?? $default;
}

            
getMessage() public method
public Yiisoft\Queue\Message\MessageInterface getMessage ( )

                final public function getMessage(): MessageInterface
{
    return $this->message;
}

            
getMeta() public method
public array getMeta ( )

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

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

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

            
getType() public method
public string getType ( )

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

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

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