...
Code Block |
---|
S4:incubator-s4$ ./gradlew s4-tools:installApp .... verbose logs ...:s4-tools:installApp |
...
Create a new application
S4 provides some scripts in order to simplify development and testing of applications. Let's see how to create a new template project and start a new sample application.
Create a new project
- Create a new application template (here, we create it in the /tmp directory):
Code Block S4:incubator-s4$ ./s4 newApp myApp -parentDir=/tmp ... some instructions on how to start ...
- This creates a sample application in the specified directory, with the following structure:
Code Block build.gradle --> the template build file, that you'll need to customize gradlew --> references the gradlew script from the S4 installation s4 --> references the s4 script from the S4 installation, and adds an "adapter" task src/ --> sources (maven-like structure)
A look at the sample project content
- The src/main/java/hello directory contains 3 files:
Code Block HelloPE.java --> a very simple PE: simply prints the name contained in incoming events HelloApp.java --> defines a simple application: exposes an input stream ("names"), connected to the HelloPE HelloInputAdapter --> a simple adapter that reads character lines from a socket, converts them into events, and sends the events to interested S4 apps
...
, through the "names" stream