CaptureListener-class {Proc4} | R Documentation |
"CaptureListener"
This listener simply takes its messages and adds them to a list. It is is mainly used for testing the message system.
This listener simply takes all messages and pushes them onto the
messages
field. The messages
field is the complete
list of received messages, most recent to most ancient. The method
lastMessage()
returns the most recent message.
This class implements the Listener
interface.
All reference classes extend and inherit methods from
"envRefClass"
.
signature(x = "CaptureListener")
: returns
true.
signature(x = "CaptureListener")
: If
the message is in the messSet
, it adds the message to the
message list. (See details)
messages
:Object of class list
the list of
messages in reverse chronological order.
lastMessage()
:Returns the most recent message.
receiveMessage(mess)
:Does the work of inserting the message. See Details.
initialize(messages, ...)
:Sets the default values for the fields.
Russell Almond
This is an example of the observer design pattern. https://en.wikipedia.org/wiki/Observer_pattern.
Listener
, P4Message
,
CaptureListener
,
UpdateListener
,
UpsertListener
,
InjectionListener
,
TableListener
,
mess1 <- P4Message(app="default",uid="Phred",context="Down Hill", sender="EABN",mess="Statistics", details=list("Physics_EAP"=0.5237,"Physics_Mode"="High")) cl <- CaptureListener() receiveMessage(cl,mess1) stopifnot(all.equal(mess1,cl$lastMessage()))