PHP Interface Uecode\Bundle\QPushBundle\Provider\ProviderInterface

Author: Keith Kirk ([email protected])
Show file Open project: uecode/qpush-bundle

Public Methods

Method Description
__construct ( string $name, array $options, mixed $client, Doctrine\Common\Cache\Cache $cache, Logger $logger ) Constructor for Provider classes
create ( ) Creates the Queue
delete ( mixed $id ) Deletes the Queue Message
destroy ( ) : boolean Destroys a Queue and clears any Queue related Cache
getCache ( ) : Doctrine\Common\Cache\Cache Returns the Cache service
getLogger ( ) : Logger Returns the Logger service
getName ( ) : string Returns the name of the Queue that this Provider is for
getNameWithPrefix ( ) : string Returns the Queue Name prefixed with the QPush Prefix
getOptions ( ) : array Returns the Provider's Configuration Options
getProvider ( ) : string Returns the Queue Provider name
log ( integer $level, string $message, array $context ) : boolean Logs data from the library
publish ( array $message, array $options = [] ) : string Publishes a message to the Queue
receive ( array $options = [] ) : array Polls the Queue for Messages

Method Details

__construct() public method

Constructor for Provider classes
public __construct ( string $name, array $options, mixed $client, Doctrine\Common\Cache\Cache $cache, Logger $logger )
$name string Name of the Queue the provider is for
$options array An array of configuration options for the Queue
$client mixed A Queue Client for the provider
$cache Doctrine\Common\Cache\Cache An instance of Doctrine\Common\Cache\Cache
$logger Monolog\Logger An instance of Mongolog\Logger

create() public method

All Create methods are idempotent, if the resource exists, the current ARN will be returned
public create ( )

delete() public method

Deletes the Queue Message
public delete ( mixed $id )
$id mixed A message identifier or resource

destroy() public method

Destroys a Queue and clears any Queue related Cache
public destroy ( ) : boolean
return boolean

getCache() public method

Returns the Cache service
public getCache ( ) : Doctrine\Common\Cache\Cache
return Doctrine\Common\Cache\Cache

getLogger() public method

Returns the Logger service
public getLogger ( ) : Logger
return Monolog\Logger

getName() public method

Returns the name of the Queue that this Provider is for
public getName ( ) : string
return string

getNameWithPrefix() public method

If a Queue name is explicitly set in the configuration, use just that name - which is beneficial for reuising existing queues not created by qpush. Otherwise, create the queue with the qpush prefix/
public getNameWithPrefix ( ) : string
return string

getOptions() public method

Returns the Provider's Configuration Options
public getOptions ( ) : array
return array

getProvider() public method

Returns the Queue Provider name
public getProvider ( ) : string
return string

log() public method

This method wraps the Logger to check if logging is enabled and adds the Queue name and Provider automatically to the context
public log ( integer $level, string $message, array $context ) : boolean
$level integer The log level
$message string The message to log
$context array The log context
return boolean Whether the record was logged

publish() public method

This method should return a string MessageId or Response
public publish ( array $message, array $options = [] ) : string
$message array The message to queue
$options array An array of options that override the queue defaults
return string

receive() public method

Depending on the Provider, this method may keep the connection open for a configurable amount of time, to allow for long polling. In most cases, this method is not meant to be used to long poll indefinitely, but should return in reasonable amount of time
public receive ( array $options = [] ) : array
$options array An array of options that override the queue defaults
return array