ListQueue-class | R Documentation |
"ListQueue"
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.
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.
Class "MessageQueue"
, directly.
All reference classes extend and inherit methods from
"envRefClass"
.
signature(queue = "MessageQueue")
:
Returns the next unprocessed message from the Queue, or 'NULL' if
there are no processed messages in the queue.
signature(col = "ListQueue", mess = "ANY")
:
Marks a message as an error, and saves error message in
queue.
signature(col = "ListQueue", mess = "ANY")
:
Marks a message as processed.
signature(queue =
"MongoQueue")
: Clears the processed flag for messages matching
the query.
Note, that currently there is no implementing method for
cleanMessageQueue
or importMessages
.
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.
$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.
This is an experimental implementation, and details may change in future release.
Russell Almond
MessageQueue
,P4Message
,
MongoDB
,
fetchNextMessage()
,
cleanMessageQueue()
,
importMessages()
,
markAsProcessed()
,
resetProcessedMessages()
,
buildMessage()
,
getOneRec()
showClass("ListQueue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.