...
Programs include MapReduce programs, Workflows, Spark programs, and Workers are and Workers, which are used to process data. Services are used to serve data.
Data abstractions include Datasets.
Applications are Applications are created using an Artifact and an Artifact and optional configuration. An An Artifact is is a JAR file that packages the Java Application class that defines how the Programsthe Programs, ServicesServices, SchedulesSchedules, and Datasets interactand Datasets interact.
It also packages any dependent classes and libraries needed to run the Application.
...
Of course, not all components are required: it . It depends on the application. A minimal application could include a workflow and a dataset. In the next pagessections, we'll look at these components, and their interactions.
...
Application classes can use a Config
class to receive a configuration when an Application is created. For example, configuration can be used to specify, at application creation time, a dataset to be read, rather than having them hard-coded in the AbstractApplication
's configure
method. The configuration class needs to be the type parameter of the AbstractApplication
class. It should also extend the Config
class present in the CDAP API. The configuration is provided as part of the request body to create an application. It is available during configuration time through the getConfig()
method in AbstractApplication
.
Information about the RESTful HTTP call is available in the Lifecycle Microservices documentation.
...
Code Block |
---|
public class UniqueCounter extends AbstractFlowlet { @Property private final String uniqueCountTableName; private UniqueCountTable uniqueCountTable; @Override public void configure(FlowletConfigurer configurer) { super.configure(configurer); } public UniqueCounter(String uniqueCountTableName) { this.uniqueCountTableName = uniqueCountTableName; } @Override public void initialize(FlowletContext context) throws Exception { super.initialize(context); uniqueCountTable = context.getDataset(uniqueCountTableName); } @ProcessInput public void process(String word) { this.uniqueCountTable.updateUniqueCount(word); } } |
Application Example
...