use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class WordCount method configure.
@Override
public void configure() {
WordCountConfig config = getConfig();
setName("WordCount");
setDescription("Example word count application");
// Ingest data into the Application via Streams
addStream(new Stream(config.getStream()));
// Store processed data in Datasets
createDataset(config.getWordStatsTable(), Table.class, TableProperties.builder().setReadlessIncrementSupport(true).setDescription("Stats of total counts and lengths of words").build());
createDataset(config.getWordCountTable(), KeyValueTable.class, DatasetProperties.builder().setDescription("Words and corresponding counts").build());
createDataset(config.getUniqueCountTable(), UniqueCountTable.class, DatasetProperties.builder().setDescription("Total count of unique words").build());
createDataset(config.getWordAssocTable(), AssociationTable.class, DatasetProperties.builder().setDescription("Word associations table").build());
// Process events in real-time using Flows
addFlow(new WordCounter(config));
// Retrieve the processed data using a Service
addService(new RetrieveCounts(config));
}
use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class WebAnalytics method configure.
@Override
public void configure() {
addStream(new Stream("log"));
addFlow(new WebAnalyticsFlow());
createDataset("UniqueVisitCount", UniqueVisitCount.class, DatasetProperties.builder().setDescription("Unique Visit Counts").build());
setName("WebAnalytics");
setDescription("Web Analytics Application");
}
use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class SparkKMeansApp method configure.
@Override
public void configure() {
setName("SparkKMeans");
setDescription("Spark KMeans app");
// Ingest data into the Application via a Stream
addStream(new Stream("pointsStream"));
// Process points data in real-time using a Flow
addFlow(new PointsFlow());
// Run a Spark program on the acquired data
addSpark(new SparkKMeansSpecification());
// Retrieve the processed data using a Service
addService(new CentersService());
// Store input and processed data in ObjectStore Datasets
try {
ObjectStores.createObjectStore(getConfigurer(), "points", Point.class, DatasetProperties.builder().setDescription("Store points data").build());
ObjectStores.createObjectStore(getConfigurer(), "centers", String.class, DatasetProperties.builder().setDescription("Store centers data").build());
} catch (UnsupportedTypeException e) {
// because String is an actual class.
throw new RuntimeException(e);
}
}
Aggregations