You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Note: these instructions are currently for the S4-22 branch

Installation

There is currently no real distribution package. So you need to download the source and build the platform.

  1. Download from Apache git repository. Follow instructions here. Checkout branch S4-22
  2. Compile and install S4 in the local maven repository: (you can also let the tests run, which is currently quite long)
    S4:incubator-s4$ ./gradlew install -DskipTests
    .... verbose logs ...
    
  3. Build the startup scripts: 
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 sample application.

Create a new project

  1. Create a new application template (here, we create it in the /tmp directory): 
    S4:incubator-s4$ ./s4 newApp myApp -parentDir=/tmp
    
    ... some instructions on how to start ...
    
  2. This creates a sample application in the specified directory, with the following structure:
    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: 

  • HelloPE.java : a very simple PE that simply prints the name contained in incoming events HelloPE
  • HelloApp.java: defines a simple application: exposes an input stream ("names"), connected to the HelloPE
  • HelloInputAdapter is 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

Run the sample project

  • No labels