Worker
in package
Tags
Table of Contents
Properties
- $acks : array<string|int, mixed>
- $bus : mixed
- $eventDispatcher : mixed
- $logger : mixed
- $metadata : mixed
- $receivers : array<string|int, mixed>
- $shouldStop : bool
- $unacks : SplObjectStorage
Methods
- __construct() : mixed
- getMetadata() : WorkerMetadata
- run() : void
- Receive the messages and dispatch them to the bus.
- stop() : void
- ack() : bool
- dispatchEvent() : void
- flush() : bool
- handleMessage() : void
Properties
$acks
private
array<string|int, mixed>
$acks
= []
$bus
private
mixed
$bus
$eventDispatcher
private
mixed
$eventDispatcher
$logger
private
mixed
$logger
$metadata
private
mixed
$metadata
$receivers
private
array<string|int, mixed>
$receivers
$shouldStop
private
bool
$shouldStop
= false
$unacks
private
SplObjectStorage
$unacks
Methods
__construct()
public
__construct(array<string|int, ReceiverInterface> $receivers, MessageBusInterface $bus[, EventDispatcherInterface $eventDispatcher = null ][, LoggerInterface $logger = null ]) : mixed
Parameters
- $receivers : array<string|int, ReceiverInterface>
-
Where the key is the transport name
- $bus : MessageBusInterface
- $eventDispatcher : EventDispatcherInterface = null
- $logger : LoggerInterface = null
getMetadata()
public
getMetadata() : WorkerMetadata
Return values
WorkerMetadatarun()
Receive the messages and dispatch them to the bus.
public
run([array<string|int, mixed> $options = [] ]) : void
Valid options are:
- sleep (default: 1000000): Time in microseconds to sleep after no messages are found
- queues: The queue names to consume from, instead of consuming from all queues. When this is used, all receivers must implement the QueueReceiverInterface
Parameters
- $options : array<string|int, mixed> = []
stop()
public
stop() : void
ack()
private
ack() : bool
Return values
booldispatchEvent()
private
dispatchEvent(object $event) : void
Parameters
- $event : object
flush()
private
flush(bool $force) : bool
Parameters
- $force : bool
Return values
boolhandleMessage()
private
handleMessage(Envelope $envelope, string $transportName) : void
Parameters
- $envelope : Envelope
- $transportName : string