PHP Class AppserverIo\Appserver\MessageQueue\MessageQueue

Inheritance: extends AppserverIo\Appserver\Core\AbstractDaemonThread, implements AppserverIo\Psr\Pms\QueueInterface
Show file Open project: appserver-io/appserver Class Usage Examples

Public Methods

Method Description
attach ( AppserverIo\Psr\Pms\MessageInterface $message ) : void Attach a new message to the queue.
bootstrap ( ) : void This method will be invoked before the while() loop starts and can be used to implement some bootstrap functionality.
cleanUp ( ) : void This method will be invoked, after the while() loop has been finished and can be used to implement clean up functionality.
getApplication ( ) : AppserverIo\Psr\Application\ApplicationInterface Returns the application instance the worker is bound to.
getManagerSettings ( ) : AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface Return's the queue manager settings.
getMessages ( ) : AppserverIo\Storage\GenericStackable Returns the storage for the messages.
getName ( ) : string Returns the queue name.
getType ( ) : string Returns the message bean type to handle the messages.
getWorkers ( ) : AppserverIo\Storage\GenericStackable Returns the storage for the workers.
injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Inject the application instance the worker is bound to.
injectManagerSettings ( AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface $managerSettings ) : void Injects the queue manager settings.
injectMessages ( AppserverIo\Storage\GenericStackable $messages ) : void Injects the storage for the messages.
injectName ( string $name ) : void Initializes the queue with the name to use.
injectType ( string $type ) : void Initializes the queue with the message bean type that has to handle the messages.
injectWorkers ( AppserverIo\Storage\GenericStackable $workers ) : void Injects the storage for the workers.
log ( mixed $level, string $message, array $context = [] ) : void This is a very basic method to log some stuff by using the error_log() method of PHP.

Protected Methods

Method Description
uniqueWorkerName ( AppserverIo\Psr\Pms\PriorityKeyInterface $priorityKey ) : string Creates a unique name to register the worker with the passed priority.

Method Details

attach() public method

Attach a new message to the queue.
public attach ( AppserverIo\Psr\Pms\MessageInterface $message ) : void
$message AppserverIo\Psr\Pms\MessageInterface The messsage to be attached to the queue
return void

bootstrap() public method

This method will be invoked before the while() loop starts and can be used to implement some bootstrap functionality.
public bootstrap ( ) : void
return void

cleanUp() public method

This method will be invoked, after the while() loop has been finished and can be used to implement clean up functionality.
public cleanUp ( ) : void
return void

getApplication() public method

Returns the application instance the worker is bound to.
public getApplication ( ) : AppserverIo\Psr\Application\ApplicationInterface
return AppserverIo\Psr\Application\ApplicationInterface The application instance

getManagerSettings() public method

Return's the queue manager settings.
public getManagerSettings ( ) : AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface
return AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface The queue manager settings

getMessages() public method

Returns the storage for the messages.
public getMessages ( ) : AppserverIo\Storage\GenericStackable
return AppserverIo\Storage\GenericStackable The storage for the messages

getName() public method

Returns the queue name.
public getName ( ) : string
return string The queue name

getType() public method

Returns the message bean type to handle the messages.
public getType ( ) : string
return string The message bean type to handle the messages

getWorkers() public method

Returns the storage for the workers.
public getWorkers ( ) : AppserverIo\Storage\GenericStackable
return AppserverIo\Storage\GenericStackable The storage for the workers

injectApplication() public method

Inject the application instance the worker is bound to.
public injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance
return void

injectManagerSettings() public method

Injects the queue manager settings.
public injectManagerSettings ( AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface $managerSettings ) : void
$managerSettings AppserverIo\Appserver\MessageQueue\QueueManagerSettingsInterface The queue manager settings
return void

injectMessages() public method

Injects the storage for the messages.
public injectMessages ( AppserverIo\Storage\GenericStackable $messages ) : void
$messages AppserverIo\Storage\GenericStackable An storage for the messages
return void

injectName() public method

Initializes the queue with the name to use.
public injectName ( string $name ) : void
$name string Holds the queue name to use
return void

injectType() public method

Initializes the queue with the message bean type that has to handle the messages.
public injectType ( string $type ) : void
$type string The message bean type to handle the messages
return void

injectWorkers() public method

Injects the storage for the workers.
public injectWorkers ( AppserverIo\Storage\GenericStackable $workers ) : void
$workers AppserverIo\Storage\GenericStackable An storage for the workers
return void

log() public method

This is a very basic method to log some stuff by using the error_log() method of PHP.
public log ( mixed $level, string $message, array $context = [] ) : void
$level mixed The log level to use
$message string The message we want to log
$context array The context we of the message
return void

uniqueWorkerName() protected method

Creates a unique name to register the worker with the passed priority.
protected uniqueWorkerName ( AppserverIo\Psr\Pms\PriorityKeyInterface $priorityKey ) : string
$priorityKey AppserverIo\Psr\Pms\PriorityKeyInterface The priority key to create a unique name for
return string The unique name