CSStagingPersistentQueue
extends CSStagingQueue
in package
Tags
Table of Contents
- bulkEnqueue() : void
- Enqueues multiple records into the queue.
- countMessages() : int
- Counts the number of messages in the staging queue based on the given filter.
- deleteMessage() : bool
- Deletes a message from the staging queue.
- deleteMessages() : int
- Deletes messages from the staging queue based on a filter.
- enqueue() : void
- Enqueues a record in the staging queue as a StagingMessage database entry.
- fetch() : array<string|int, mixed>
- Fetches entries from the staging queue as their API object. A fetch always queues the messages.
- getMessage() : CSStagingMessage
- Retrieves the Stagingmessage API object.
- getMessages() : array<string|int, mixed>
- Retrieves messages based on a given filter
- getSortFilter() : string
- Definition for the fetch SortFilter for persistent messages
- hasMessagesForProcessing() : bool
- Checks if there are any messages for processing in the staging queue.
- purge() : bool
- Purges the staging queue.
- queryMessages() : array<string|int, mixed>
- Queries the messages from the staging queue.
- reset() : bool
- Resets all messages in the staging queue so they are dequeued.
- storeMessage() : bool
- Stores a CSStagingMessage API object in the database.
Methods
bulkEnqueue()
Enqueues multiple records into the queue.
public
static bulkEnqueue(string $sRecordType, array<string|int, mixed> $aRecordIds[, string $sOperationType = '' ], int $iPriority) : void
Parameters
- $sRecordType : string
-
The type of the records.
- $aRecordIds : array<string|int, mixed>
-
The IDs of the records to enqueue.
- $sOperationType : string = ''
-
The type of operation to perform on the records (optional).
- $iPriority : int
Tags
Return values
void —countMessages()
Counts the number of messages in the staging queue based on the given filter.
public
static countMessages([CSStagingQueueFilter $oFilter = null ]) : int
Parameters
- $oFilter : CSStagingQueueFilter = null
Tags
Return values
int —The number of messages that match the filter.
deleteMessage()
Deletes a message from the staging queue.
public
static deleteMessage(int $iMessageId) : bool
Parameters
- $iMessageId : int
-
The ID of the message to be deleted.
Tags
Return values
bool —Returns true if the message was successfully deleted, false otherwise.
deleteMessages()
Deletes messages from the staging queue based on a filter.
public
static deleteMessages(CSStagingQueueFilter $oFilter) : int
Parameters
- $oFilter : CSStagingQueueFilter
Tags
Return values
int —The number of messages deleted.
enqueue()
Enqueues a record in the staging queue as a StagingMessage database entry.
public
static enqueue([array<string|int, mixed> $aArguments = array() ]) : void
For persistent queues the RecordID and RecordType are required. For example: ['RecordID' => 1, 'RecordType' => 'Pdmarticle']
Parameters
- $aArguments : array<string|int, mixed> = array()
-
The arguments for the job.
Tags
Return values
void —fetch()
Fetches entries from the staging queue as their API object. A fetch always queues the messages.
public
static fetch(int $iBatchSize[, CSStagingQueueFilter $oAdditionalFilter = null ]) : array<string|int, mixed>
Make sure to dequeue/acknowledge/reject the messages after processing them.
Note: To only analyse messages without fetching them use the getMessages API.
Parameters
- $iBatchSize : int
-
The number of items to fetch.
- $oAdditionalFilter : CSStagingQueueFilter = null
Tags
Return values
array<string|int, mixed> —An array of fetched item APIs.
getMessage()
Retrieves the Stagingmessage API object.
public
static getMessage(int|StagingMessage $mMessageOrId) : CSStagingMessage
Parameters
- $mMessageOrId : int|StagingMessage
-
The ID or instance of the staging message DB object.
Tags
Return values
CSStagingMessage —The retrieved staging message api.
getMessages()
Retrieves messages based on a given filter
public
static getMessages([CSStagingQueueFilter $oFilter = null ]) : array<string|int, mixed>
Parameters
- $oFilter : CSStagingQueueFilter = null
Tags
Return values
array<string|int, mixed> —An array containing the retrieved messages.
getSortFilter()
Definition for the fetch SortFilter for persistent messages
public
static getSortFilter() : string
Tags
Return values
string —The sort filter.
hasMessagesForProcessing()
Checks if there are any messages for processing in the staging queue.
public
static hasMessagesForProcessing() : bool
Tags
Return values
bool —Returns true if there are messages for processing, false otherwise.
purge()
Purges the staging queue.
public
static purge() : bool
Tags
Return values
bool —Returns true if the purge operation is successful, false otherwise.
queryMessages()
Queries the messages from the staging queue.
public
static queryMessages(array<string|int, mixed> $aFields, CSStagingQueueFilter $oFilter, int $iLimit) : array<string|int, mixed>
Parameters
- $aFields : array<string|int, mixed>
-
The fields to retrieve for each message.
- $oFilter : CSStagingQueueFilter
-
The filter to apply to the query.
- $iLimit : int
-
The maximum number of messages to retrieve (default: 0 for no limit).
Tags
Return values
array<string|int, mixed> —The array of messages matching the query.
reset()
Resets all messages in the staging queue so they are dequeued.
public
static reset() : bool
Primarily used for failover scenarios.
Tags
Return values
bool —Returns true if the staging queue is successfully reset, false otherwise.
storeMessage()
Stores a CSStagingMessage API object in the database.
public
static storeMessage(CSStagingMessage $oMessage) : bool
Parameters
- $oMessage : CSStagingMessage
Tags
Return values
bool —Returns true if the message is successfully stored, false otherwise.
