P4Message-class {Proc4}R Documentation

Class "P4Message"

Description

This is a message which is sent from one process to another in the four process architecture. There are certain header fields with are used to route the message and the details field which is an arbitrary list of data which will can be used by the receiver.

This class represents a semi-structured data object with certain header fields which can be indexed plus the free-form details() field which contains the body of the message. It can be serielized in JSON format (using as.json) or saved in the Mongo database (using the mongolite package).

Objects from the Class

Objects can be created by calls to the P4Message() function.

Message Queues

Because all messages have a processed flag and a timestamp, a message collection becomes a queue. Simply search for the message with the earliest timestamp with processed(mess)==FALSE and excute that. Then sets processed equal to true using markAsProcessed.

If an error occurs during processing, the error can be associated with the message by setting the pError field using markAsError.

Slots

_id:

Used for internal database ID.

app:

Object of class "character" which specifies the application in which the messages exit.

uid:

Object of class "character" which identifies the user (student).

context:

Object of class "character" which identifies the context, task, or item.

sender:

Object of class "character" which identifies the sender. This is usually one of "Presentation Process", "Evidence Identification Process", "Evidence Accumulation Process", or "Activity Selection Process".

mess:

Object of class "character" a general title for the message context.

timestamp:

Object of class "POSIXt" which gives the time at which the message was generated.

data:

Object of class "list" which contains the data to be transmitted with the message.

processed:

A logical value: true if the message has been processed, and false if the message is still in queue to be processed. This field is set with markAsProcessed.

pError:

If a error occurs while processing this event, information about the error can be stored here, either as an R object, or as an R object of class error (or any class). This field is accessed with processingError and set with markAsError.

Methods

m_id

signature(x = "ANY"): returns the _id field, the database ID.

app

signature(x = "P4Message"): returns the app field.

as.jlist

signature(obj = "P4Message", ml = "list"): coerces the object into a list to be processed by toJSON.

as.json

signature(x = "P4Message"): Coerces the message into a JSON string.

context

signature(x = "P4Message"): returns the context field.

details

signature(x = "P4Message"): returns the data associated with the message as a list.

mess

signature(x = "P4Message"): returns the message field.

sender

signature(x = "P4Message"): returns the sender field.

timestamp

signature(x = "P4Message"): returns the timestamp.

uid

signature(x = "P4Message"): returns the user ID.

processing

signature(x = "P4Message"): returns a logical value indicated whether or not the message has been marked as processed.

processingError

signature(x = "P4Message"): if an error occurred while processing this message, returns a value describing the error. Otherwise, returns NULL.

Author(s)

Russell G. Almond

References

Almond, R. G., Steinberg, L. S., and Mislevy, R.J. (2002). Enhancing the design and delivery of Assessment Systems: A Four-Process Architecture. Journal of Technology, Learning, and Assessment, 1, http://ejournals.bc.edu/ojs/index.php/jtla/article/view/1671.

See Also

P4Message() — constructor parseMessage, saveRec, getOneRec

Examples

showClass("P4Message")

[Package Proc4 version 0.4-6 Index]