A Class for reading and executing tasks from a source
A Class for reading and executing tasks from a source
handlers
A list of handlers
stopped
Is currently stopped.
laterHandle
A callback handle.
new()
Creates the object.
Consumer$new(source)
source
A source, e.g. TextFileSource.
setSource()
Sets the source.
Consumer$setSource(source)
source
A source, e.g. TextFileSource.
getSource()
Gets the source.
Consumer$getSource()
consume()
Executes all (unprocessed) signals fired to source from a Producer.
if throwErrors
is TRUE, the first error encountered is thrown
after executing all signals. Signals are executed in the env
environment.
If env
is NULL, the environment set at initialization is used.
Consumer$consume(throwErrors = TRUE, env = parent.frame())
throwErrors
Should errors be thrown or caught.
env
The execution environment.
start()
Starts executing consume
every millis
milliseconds. throwErrors
and env
are passed down to consume
Consumer$start(millis = 250, env = parent.frame())
millis
milliseconds.
env
The execution environment.
addHandler()
Adds a handler for 'signal'. func
Consumer$addHandler(func, signal)
func
The function which takes three parameters: 1. the signal, 2. the message object, and 3. the evaluation environment.
signal
A string to bind the function to.
clearHandlers()
Removes all handler.s
Consumer$clearHandlers()
removeHandler()
Removes a single handler.
Consumer$removeHandler(signal, index)
signal
The signal of the handler.
index
The index of the handler to remove from the signal.
initHandlers()
Adds default handlers.
Consumer$initHandlers()
finalize()
cleans up object.
Consumer$finalize()
clone()
The objects of this class are cloneable with this method.
Consumer$clone(deep = FALSE)
deep
Whether to make a deep clone.