Versions Compared

Key

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

...

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. 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)
    Code Block
    ./s4 adapter -appClass=hello.HelloInputAdapter -c=cluster2 -namedStringParameters=adapter.output.stream:names
  3. 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
  4. One of the nodes should output in its console:
    Code Block
    Hello Bob!

...