Overview

Namespaces

  • Avisota
    • Event
    • Message
    • Queue
    • Recipient
    • RecipientSource
    • Renderer
    • Templating
    • Test
      • Database
      • Imap
      • Message
      • Queue
      • Renderer
      • Transport
    • Transport

Classes

  • ExecutionConfig
  • QueueHelper
  • SimpleDatabaseQueue

Interfaces

  • ArchivingQueueInterface
  • EventEmittingQueueInterface
  • ExecutionDeciderInterface
  • LoggingQueueInterface
  • MutableQueueInterface
  • QueueInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download

Class SimpleDatabaseQueue

A simple single threaded queue storing the messages in a small database table.

Avisota\Queue\SimpleDatabaseQueue implements Avisota\Queue\MutableQueueInterface, Avisota\Queue\EventEmittingQueueInterface, Avisota\Queue\LoggingQueueInterface
Namespace: Avisota\Queue
Package: Avisota\Queue
Located at src/Avisota/Queue/SimpleDatabaseQueue.php
Methods summary
public static
# createTableSchema( mixed $tableName )
public
# __construct( Doctrine\DBAL\Connection $connection, Doctrine\DBAL\Connection $tableName, string $createTableIfNotExists = false, Psr\Log\LoggerInterface $logger = null, Symfony\Component\EventDispatcher\EventDispatcher $eventDispatcher = null )

Parameters

$connection
Avisota\Message\NativeMessage
$messageSerializer The message serializer.
$tableName
Doctrine\DBAL\Connection
$connection The database connection.
$createTableIfNotExists
string
$tableName The name of the database table.
$logger
boolean
$createTableIfNotExists Create the table if not exists.
$eventDispatcher
public Avisota\Queue\QueueInterface
# setEventDispatcher( Symfony\Component\EventDispatcher\EventDispatcher $eventDispatcher = null )

Set the event dispatcher for this queue.

Set the event dispatcher for this queue.

Parameters

$eventDispatcher
Symfony\Component\EventDispatcher\EventDispatcher|null
$eventDispatcher

Returns

Avisota\Queue\QueueInterface

Implementation of

Avisota\Queue\EventEmittingQueueInterface::setEventDispatcher()
public Symfony\Component\EventDispatcher\EventDispatcher|null
# getEventDispatcher( )

Get the event dispatcher for this queue.

Get the event dispatcher for this queue.

Returns

Symfony\Component\EventDispatcher\EventDispatcher|null

Implementation of

Avisota\Queue\EventEmittingQueueInterface::getEventDispatcher()
public Avisota\Queue\QueueInterface
# setLogger( Psr\Log\LoggerInterface $logger = null )

Set the logger for this queue.

Set the logger for this queue.

Parameters

$logger
Psr\Log\LoggerInterface
$logger

Returns

Avisota\Queue\QueueInterface

Implementation of

Avisota\Queue\LoggingQueueInterface::setLogger()
public Psr\Log\LoggerInterface|null
# getLogger( )

Get the logger for this queue.

Get the logger for this queue.

Returns

Psr\Log\LoggerInterface|null

Implementation of

Avisota\Queue\LoggingQueueInterface::getLogger()
public boolean
# isEmpty( )

Check if the queue is empty.

Check if the queue is empty.

Returns

boolean

Implementation of

Avisota\Queue\QueueInterface::isEmpty()
public integer
# length( )

Return the length of the queue.

Return the length of the queue.

Returns

integer

Implementation of

Avisota\Queue\QueueInterface::length()
public Avisota\Message\MessageInterface[]
# getMessages( )

Return all messages from the queue.

Return all messages from the queue.

Returns

Avisota\Message\MessageInterface[]

Implementation of

Avisota\Queue\QueueInterface::getMessages()
public Avisota\Transport\TransportStatus[]
# execute( Avisota\Transport\TransportInterface $transport, Avisota\Queue\ExecutionConfig $config = null )

Execute a queue and send all messages.

Execute a queue and send all messages.

Parameters

$transport
Avisota\Queue\QueueInterface
$queue
$config
Avisota\Transport\TransportInterface
$transport

Returns

Avisota\Transport\TransportStatus[]

Implementation of

Avisota\Queue\QueueInterface::execute()
protected array[]
# selectRecords( Avisota\Queue\ExecutionConfig $config = null )

Returns

array[]
protected Avisota\Message\MessageInterface
# deserializeMessage( array $record )

Parameters

$record
array
$record

Returns

Avisota\Message\MessageInterface
protected Avisota\Transport\TransportStatus
# transport( Avisota\Transport\TransportInterface $transport, Avisota\Queue\ExecutionDeciderInterface $decider = null, mixed $record )

Do the transport of the message and create a status information object.

Do the transport of the message and create a status information object.

Parameters

$transport
Avisota\Transport\TransportInterface
$transport
$decider
Avisota\Message\MessageInterface
$message
$record

Returns

Avisota\Transport\TransportStatus
protected
# prepareRecipientsForLogging( array $recipients )
protected
# logPreTransportStatus( Avisota\Transport\TransportInterface $transport, Avisota\Message\MessageInterface $message )
protected
# logSuccessfulStatus( Avisota\Transport\TransportInterface $transport, Avisota\Message\MessageInterface $message, Avisota\Transport\TransportStatus $status )
protected
# logFailedStatus( Avisota\Transport\TransportInterface $transport, Avisota\Message\MessageInterface $message, Avisota\Transport\TransportStatus $status )
public boolean
# enqueue( Avisota\Message\MessageInterface $message, DateTime $deliveryDate = null )

Enqueue a message.

Enqueue a message.

Parameters

$message
Avisota\Message\MessageInterface
$message The message to enqueue.
$deliveryDate
DateTime
$deliveryDate The message will not delivered until this date is reached.

Returns

boolean

Implementation of

Avisota\Queue\QueueInterface::enqueue()
public boolean
# dequeue( Avisota\Message\MessageInterface $message )

Dequeue a message.

Dequeue a message.

Parameters

$message
Avisota\Message\MessageInterface
$message The message to dequeue.

Returns

boolean

Implementation of

Avisota\Queue\MutableQueueInterface::dequeue()
Properties summary
protected Doctrine\DBAL\Connection $connection
#
protected string $tableName
#
protected Psr\Log\LoggerInterface $logger
#
protected Symfony\Component\EventDispatcher\EventDispatcher $eventDispatcher
#
avisota/core API documentation generated by ApiGen 2.8.0