Description Usage Arguments Value Additional Info Author(s) See Also Examples
A Tuple
is the main data object that is passed around in a stream. The spout emits Tuples to the different Bolts, and Bolts can Emit Tuples to one another depending on the Topology. The Emit
function checks whether indeed objects of type Tuple
are emitted. A Tuple
object is a single row data.frame.
1 |
x |
a single row data.frame |
... |
any other argument |
an object of type Tuple
to be used by an RStorm emitter function
The is.Tuple
function checks whether an object is of Type Tuple and is used internally.
Maurits Kaptein
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Example of a simple object emitted down a stream
spout <- data.frame(x=seq(1,4))
topology <- Topology(spout)
# The Emit function will check if the emitted object is indeed a Tuple
bolt.1 <- function(x, ...){
Emit(Tuple(x), ...)
}
bolt.2 <- function(x, ...){
x <- as.numeric(x[1])
print(x^2)
}
topology <- AddBolt(topology, Bolt(bolt.1, listen=0))
topology <- AddBolt(topology, Bolt(bolt.1, listen=1))
topology <- AddBolt(topology, Bolt(bolt.2, listen=2))
result <- RStorm(topology)
#plot(topology)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.