Skip to content

Stream Processing with SQL

This page shows how to processing stream data in HStreamDB with SQL using Java SDK.


Make sure you have HStreamDB running and accessible.

Execute Real-time Query on Stream

You can execute a real-time query on stream using the HStreamClient.streamQuery() method:

final String TEST_STREAM = "test_stream";

Publisher<HRecord> publisher = client.streamQuery(
        "select * from " + TEST_STREAM +
        " where temperature > 30 emit changes;"

Observer<HRecord> observer = new Observer<HRecord>() {
    public void onNext(HRecord hrecord) {

    public void onError(Throwable t) {
        throw new RuntimeException(t);

    public void onCompleted() {



The HStreamClient.streamQuery() method return a Publisher object, and you need to provide an Observer object that contains your logic for processing the results returned by the query.

Back to top