Overview

Namespaces

  • Charcoal
    • Queue

Classes

  • AbstractQueueManager

Interfaces

  • QueueableInterface
  • QueueItemInterface
  • QueueManagerInterface

Traits

  • QueueableTrait
  • QueueItemTrait
  • Overview
  • Namespace
  • Class

Class AbstractQueueManager

Abstract Queue Manager

The queue manager is used to load queued items and batch-process them.

Loading queued items

If a "queue_id" is specified, only the item for this specific queue will be loaded. Otherwise, all unprocessed queue items will be processed.

Type of queue items

The type of queue items can be set in extended concrete class with the queue_item_proto() method. This method should return a QueueItemInterface instance.

Callbacks

There are 4 available callback methods that can be set:

  • item_callback - Called after an item has been processed. - Arguments: QueueModelInterface $item
  • item_success_callback
  • item_failure_callback
  • processed_callback - Called when the entire queue has been processed - Arguments: array $success, array $failures
Charcoal\Queue\AbstractQueueManager implements Charcoal\Queue\QueueManagerInterface, Psr\Log\LoggerAwareInterface uses Psr\Log\LoggerAwareTrait (not available)
Abstract
Namespace: Charcoal\Queue
Located at Charcoal/Queue/AbstractQueueManager.php
Methods summary
public
# __construct( array $data = [] )

Construct new queue manager.

Construct new queue manager.

Parameters

$data
Dependencies and settings.
protected Charcoal\Queue\QueueItemInterface
# setQueueItemFactory( Charcoal\Factory\FactoryInterface $factory )

Parameters

$factory
The factory used to create queue items.

Returns

Charcoal\Queue\QueueItemInterface
Chainable
protected Charcoal\Factory\FactoryInterface
# queueItemFactory( )

Returns

Charcoal\Factory\FactoryInterface
public Charcoal\Queue\AbstractQueueManager
# setData( array $data )

Set the manager's data.

Set the manager's data.

Parameters

$data
The queue data to set.

Returns

Charcoal\Queue\AbstractQueueManager
Chainable
public Charcoal\Queue\AbstractQueueManager
# setQueueId( mixed $id )

Set the queue's ID.

Set the queue's ID.

Parameters

$id
The unique queue identifier.

Returns

Charcoal\Queue\AbstractQueueManager
Chainable

Implementation of

Charcoal\Queue\QueueManagerInterface::setQueueId()
public mixed
# queueId( )

Get the queue's ID.

Get the queue's ID.

Returns

mixed

Implementation of

Charcoal\Queue\QueueManagerInterface::queueId()
public Charcoal\Queue\QueueManagerInterface
# setItemCallback( callable $callback )

Set the callback routine when an item is processed.

Set the callback routine when an item is processed.

Parameters

$callback
A item callback routine.

Returns

Charcoal\Queue\QueueManagerInterface
Chainable
public Charcoal\Queue\QueueManagerInterface
# setItemSuccessCallback( callable $callback )

Set the callback routine when the item is resolved.

Set the callback routine when the item is resolved.

Parameters

$callback
A item callback routine.

Returns

Charcoal\Queue\QueueManagerInterface
Chainable

Implementation of

Charcoal\Queue\QueueManagerInterface::setItemSuccessCallback()
public Charcoal\Queue\QueueManagerInterface
# setItemFailureCallback( callable $callback )

Set the callback routine when the item is rejected.

Set the callback routine when the item is rejected.

Parameters

$callback
A item callback routine.

Returns

Charcoal\Queue\QueueManagerInterface
Chainable

Implementation of

Charcoal\Queue\QueueManagerInterface::setItemFailureCallback()
public Charcoal\Queue\QueueManagerInterface
# setProcessedCallback( callable $callback )

Set the callback routine when the queue is processed.

Set the callback routine when the queue is processed.

Parameters

$callback
A queue callback routine.

Returns

Charcoal\Queue\QueueManagerInterface
Chainable

Implementation of

Charcoal\Queue\QueueManagerInterface::setProcessedCallback()
public boolean
# processQueue( callable $callback = null )

Process the items of the queue.

Process the items of the queue.

If no callback is passed and a self::$processedCallback is set, the latter is used.

Parameters

$callback

An optional alternative callback routine executed after all queue items are processed.

Returns

boolean
Success / Failure

Implementation of

Charcoal\Queue\QueueManagerInterface::processQueue()
public Collection
# loadQueueItems( )

Retrieve the items of the current queue.

Retrieve the items of the current queue.

Returns

Collection

Implementation of

Charcoal\Queue\QueueManagerInterface::loadQueueItems()
abstract public Charcoal\Queue\QueueItemInterface
# queueItemProto( )

Retrieve the queue item's model.

Retrieve the queue item's model.

Returns

Charcoal\Queue\QueueItemInterface

Implementation of

Charcoal\Queue\QueueManagerInterface::queueItemProto()
API documentation generated by ApiGen