Versions Compared

Key

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

...

  1. First, we need to define a new S4 subcluster for that app:
    Code Block
    S4:myApp$ ./s4 newCluster -c=cluster2 -nbTasks=1 -flp=13000
  2. Then we can start the adapter, and we use "names" for identifying the output stream (this is the same name used as input by the myApp app)
    (warning)  Note: if you have followed this tutorial before, you may notice the change in the syntax for inline parameters (-p option)
Code Block
./s4 adapter -appClass=hello.HelloInputAdapter -c=cluster2 -

...

p={adapter.output.stream

...

=names}
  1. Now let's just provide some data to the external stream (our adapter is listening to port 15000):
    Code Block
    S4:~$ echo "Bob" | nc localhost 15000
  2. One of the nodes should output in its console:
    Code Block
    Hello Bob!

...

  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
  4. Start 1 node for the adapter app:
    Code Block
    ./s4 node -c=cluster2 -namedStringParametersp={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

...