Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Great! The application is now deployed on 2 S4 nodes. It needs some input though...

(grey lightbulb) You can check the status of the application, nodes and streams with the "status" command:

Code Block

 ./s4 status

Now what we need is some input!

We can get input through an adapter, i.e. an S4 app that converts an external stream into S4 events, and injects the events into S4 clusters. In the sample application, the adapter is a very basic class, that extends App, listens to an input socket on port 15000, and converts each received line of characters into a generic S4 event, in which the line data is kept in a "name" field. We specify :

...

  1. Start a Zookeeper instance. From the S4 base directory, do:
    Code Block
    ./s4 zkServer
  2. Define 2 clusters : 1 for deploying the twitter-counter app, and 1 for the adapter app
    Code Block
    ./s4 newCluster -c=cluster1 -nbTasks=2 -flp=12000; ./s4 newCluster -c=cluster2 -nbTasks=1 -flp=13000
  3. Start 2 app nodes (you may want to start each node in a separate console) :
    Code Block
    ./s4 node -c=cluster1
    ./s4 node -c=cluster1
    
  4. Start 1 node for the adapter app:
    Code Block
    ./s4 node -c=cluster2 '-p={adapter.output.stream=RawStatus}'
  5. Deploy twitter-counter app (you may also first build the s4r then publish it, as described in the previous section)
    Code Block
    ./s4 deploy -appName=twitter-counter -c=cluster1 -b=`pwd`/test-apps/twitter-counter/build.gradle
  6. Deploy twitter-adapter app. In this example, we don't directly specify the app class of the adapter, we use the deployment approach for apps (remember, the adapter is also an app).
    Code Block
    ./s4 deploy -appName=twitter-adapter -c=cluster2 -b=`pwd`/test-apps/twitter-adapter/build.gradle
  7. Observe the current 10 most popular topics in file TopNTopics.txt. The file gets updated at regular intervals, and only outputs topics with a minimum of 10 occurrences, so you may have to wait a little before the file is updated :
    Code Block
    tail -f TopNTopics.txt
  8. You may also check the status of the S4 node with:
    Code Block
    ./s4 status

...

What next?

You have now seen some basics applications, and you know how to run them, and how to get events into the system. You may now try to code your own apps with your own data.

...