Learn R Programming

RStorm (version 1.0)

AddBolt: Function to add a Bolt to a Topology object to specify a stream.

Description

AddBolt is an auxiliary function for building up a RStorm topology. After initializing a Topology object the AddBolt function can be used to build the topology and specify the order of the Bolts. A Bolt receives as its first argument the Tuple emitted by the previous element in the Stream.

Usage

AddBolt(topology, bolt, .verbose = TRUE)

Arguments

topology

a Topology object to add the bolt to.

bolt

a Bolt to add to the topology. These are created using the Bolt() function.

.verbose

a logical indicator to state whether or not verbose output should be printed. Default TRUE.

Value

An object of type Topology which is a list containing the following elements:

spout

the data.frame passed as a spout

bolts

a list of bolts, see Bolt

finailze

the finalize function to be used for the stream

The specified Bolt has now been added to the list of bolts. See Topology for more info.

Warning

Functions which get added to a Topology using the AddBolt functionality should always use the ... argument. This argument is used to facilitate the processing of the stream. See example below for a minimal functional example of a correctly specified bolt.

See Also

See Also: Topology, Bolt, RStorm

Examples

Run this code
# NOT RUN {
# Create a topology and add a bolt to it.
bolt1 <- function(x, ...){print(x)}
topology <- Topology(data.frame(x=c(1:10)))
topology <- AddBolt(topology, Bolt(bolt1, listen=0))
topology

# }

Run the code above in your browser using DataLab