use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class ConfigTestApp method configure.
@Override
public void configure() {
setName(NAME);
ConfigClass configObj = getConfig();
addStream(new Stream(configObj.streamName));
createDataset(configObj.tableName, KeyValueTable.class);
addWorker(new DefaultWorker(configObj.streamName));
addFlow(new SimpleFlow(configObj.streamName, configObj.tableName));
}
use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class FakeApp method configure.
@Override
public void configure() {
setName(NAME);
addStream(new Stream(STREAM_NAME));
addDatasetModule(FakeDatasetModule.NAME, FakeDatasetModule.class);
createDataset(DS_NAME, FakeDataset.class.getName());
addFlow(new FakeFlow());
addSpark(new FakeSpark());
addWorkflow(new FakeWorkflow());
AppConfig config = getConfig();
if (config.addTimeSchedule) {
scheduleWorkflow(Schedules.builder(config.timeScheduleName).createTimeSchedule(config.timeScheduleCron), FakeWorkflow.NAME);
}
if (config.addSizeSchedule) {
scheduleWorkflow(Schedules.builder(config.sizeScheduleName).createDataSchedule(Schedules.Source.STREAM, STREAM_NAME, STREAM_TRIGGER_MB), FakeWorkflow.NAME);
}
addService(PingService.NAME, new PingService());
addService(PrefixedEchoHandler.NAME, new PrefixedEchoHandler());
}
use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class SpamClassifier method configure.
@Override
public void configure() {
setName("SpamClassifier");
setDescription("A Spark Streaming Example for Kafka Message Classification");
addStream(new Stream(STREAM));
addSpark(new SpamClassifierProgram());
addService(SERVICE_HANDLER, new SpamClassifierServiceHandler());
// Store for message classification status
try {
ObjectStores.createObjectStore(getConfigurer(), DATASET, Double.class, DatasetProperties.builder().setDescription("Kafka Message Spam " + "Classification").build());
} catch (UnsupportedTypeException e) {
// because Double is an actual class.
throw new RuntimeException(e);
}
}
use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class HelloWorld method configure.
@Override
public void configure() {
setName("HelloWorld");
setDescription("A Hello World program for the Cask Data Application Platform");
addStream(new Stream("who"));
createDataset("whom", KeyValueTable.class, DatasetProperties.builder().setDescription("Store names").build());
addFlow(new WhoFlow());
addService(new Greeting());
}
use of co.cask.cdap.api.data.stream.Stream in project cdap by caskdata.
the class LogAnalysisApp method configure.
@Override
public void configure() {
setDescription("CDAP Log Analysis App");
// A stream to ingest log data
addStream(new Stream(LOG_STREAM));
// A Spark and MapReduce for processing log data
addSpark(new ResponseCounterSpark());
addMapReduce(new HitCounterProgram());
addWorkflow(new LogAnalysisWorkflow());
// Services to query for result
addService(HIT_COUNTER_SERVICE, new HitCounterServiceHandler());
addService(RESPONSE_COUNTER_SERVICE, new ResponseCounterHandler());
addService(REQUEST_COUNTER_SERVICE, new RequestCounterHandler());
// Datasets to store output after processing
createDataset(RESPONSE_COUNT_STORE, KeyValueTable.class, DatasetProperties.builder().setDescription("Store response counts").build());
createDataset(HIT_COUNT_STORE, KeyValueTable.class, DatasetProperties.builder().setDescription("Store hit counts").build());
createDataset(REQ_COUNT_STORE, TimePartitionedFileSet.class, FileSetProperties.builder().setOutputFormat(TextOutputFormat.class).setOutputProperty(TextOutputFormat.SEPERATOR, ":").setDescription("Store request counts").build());
}
Aggregations