Class Message
Namespace: Cake\Queue\Job
Property Summary
-
$callable protected
?Closure -
$parsedBody protected
array<string, mixed>
Method Summary
-
__construct() public
-
__toString() public
Convert the message to a string representation.
-
getArgument() public
-
getCallable() public
Get a closure containing the callable in the job.
-
getContext() public
Get the queue context.
-
getMaxAttempts() public
The maximum number of attempts allowed by the job.
-
getOriginalMessage() public
Get the original queue message.
-
getParsedBody() public
Get the parsed message body.
-
getTarget() public
Get the target class and method.
-
jsonSerialize() public
Serialize the message to JSON.
Method Detail
__construct() ¶ public
__construct(Interop\Queue\Message $originalMessage, Interop\Queue\Context $context, Cake\Core\ContainerInterface|null $container = null)
Parameters
-
Interop\Queue\Message$originalMessage Queue message.
-
Interop\Queue\Context$context Context.
-
Cake\Core\ContainerInterface|null$container optional DI container instance
__toString() ¶ public
__toString(): string
Convert the message to a string representation.
Returns
stringgetArgument() ¶ public
getArgument(mixed $key = null, mixed $default = null): mixed
Parameters
-
mixed$key optional Key
-
mixed$default optional Default value.
Returns
mixedgetCallable() ¶ public
getCallable(): Closure
Get a closure containing the callable in the job.
Supported callables include:
- array of [class, method]. The class will be constructed with no constructor parameters.
Returns
ClosuregetContext() ¶ public
getContext(): Interop\Queue\Context
Get the queue context.
Returns
Interop\Queue\ContextgetMaxAttempts() ¶ public
getMaxAttempts(): int|null
The maximum number of attempts allowed by the job.
Returns
int|nullgetOriginalMessage() ¶ public
getOriginalMessage(): Interop\Queue\Message
Get the original queue message.
Returns
Interop\Queue\MessagegetParsedBody() ¶ public
getParsedBody(): array<string, mixed>
Get the parsed message body.
Returns
array<string, mixed>getTarget() ¶ public
getTarget(): array{string, string}
Get the target class and method.
Returns
array{string, string}jsonSerialize() ¶ public
jsonSerialize(): array<string, mixed>
Serialize the message to JSON.
Returns
array<string, mixed>