Tuple: Function to create an object of type 'Tuple' to emit down a...

Description Usage Arguments Value Additional Info Author(s) See Also Examples

View source: R/tuple.R

Description

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.

Usage

1
Tuple(x, ...)

Arguments

x

a single row data.frame

...

any other argument

Value

an object of type Tuple to be used by an RStorm emitter function

Additional Info

The is.Tuple function checks whether an object is of Type Tuple and is used internally.

Author(s)

Maurits Kaptein

See Also

Emit, Topology, RStorm

Examples

 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)

RStorm documentation built on May 2, 2019, 9:14 a.m.

Related to Tuple in RStorm...