Reading data from a stream in Java

This section provides a code example for reading tuple rows from streams in Java.

Now you can read a tuple (row) from the stream:

Tuple tuple = subscription.getNextTuple(1000);

The parameter specifies a timeout for this blocking call, in milliseconds.

In your application you process the data in the tuple according to your design, but this example simply prints out the tuple using the message serializer.

Make sure to check the return value of getNextTuple for null, which indicates that no row is available.