ListQueue-class: Class '"ListQueue"'

ListQueue-classR Documentation

Class "ListQueue"

Description

This is a minimal implementation of the MessageQueue abstract class. In this case, the messages are just held in an internal array. It probably works well for short queues, and does not require a database or other external connection, so it useful for testing.

Details

The queue is implemented with a list and a pointer to the current position in the list. The $hasNext() and $nextMessage() methods implement a typical iterator paradigm.

Note that the MessageQueue paradigm is slightly different. Here the current message is the one returned by fetchNextMessage() until is is marked as processed (markAsProcessed()), which will then cause the $nextMessage() method to be called advancing the postition.

Extends

Class "MessageQueue", directly.

All reference classes extend and inherit methods from "envRefClass".

Methods

fetchNextMessage

signature(queue = "MessageQueue"): Returns the next unprocessed message from the Queue, or 'NULL' if there are no processed messages in the queue.

markAsError

signature(col = "ListQueue", mess = "ANY"): Marks a message as an error, and saves error message in queue.

markAsProcessed

signature(col = "ListQueue", mess = "ANY"): Marks a message as processed.

resetProcessedMessages

signature(queue = "MongoQueue"): Clears the processed flag for messages matching the query.

Note, that currently there is no implementing method for cleanMessageQueue or importMessages.

Fields

app:

Object of class character giving ID of application.

messages:

Object of class list giving the messages.

pos:

Object of class integer giving the current position of the queue.

Class-Based Methods

$nextMessage():

Advances the position, and returns the next message (or 'NULL' if all messages have been returned.

$getCurrent():

Returns the current message.

$initialize(app, messages, ...):

initializer

$reset():

Resets the position to the beginnnig of the queue.

$setCurrent(newmess):

Updates the message at the current position.

hasNext():

Returns true if there are more messages in the queue.

fetchNextMessage():

Fetches the next unprocessed message. This is either the current message, if not processed, or the $nextMessage() method is called until the first unprocessed message is found.

$count():

Returns the number of messages remaining in queue. Note, count includes both processed and unprocessed messages.

Note

This is an experimental implementation, and details may change in future release.

Author(s)

Russell Almond

See Also

MessageQueue,P4Message, MongoDB, fetchNextMessage(), cleanMessageQueue(), importMessages(), markAsProcessed(), resetProcessedMessages(), buildMessage(), getOneRec()

Examples

showClass("ListQueue")

ralmond/Proc4 documentation built on June 13, 2025, 7:13 a.m.