Skip to content

Consume data

This page shows how to consume data from HStreamDB using Java SDK.


Make sure you have HStreamDB running and accessible.


Before you can consume data, you first need to create a Consumer object using the HStreamClient.newConsumer() method:

Consumer consumer = client.newConsumer()

A consumer must be associated with a subscription, and a subscription contains a stream.

Once the consumer is created successfully, it can be used to continuously receive data from the subscribed stream.

Receive Raw Records

You can receive receive raw records using the Consumer.pollRawRecords() method:

while(true) {
    List<ReceivedRawRecord> receivedRawRecords = consumer.pollRawRecords();
    for(ReceivedRawRecord receivedRawRecord: receivedRawRecords) {

Receive HRecords

You can receive receive hrecords using the Consumer.pollHRecords() method:

while(true) {
    List<ReceivedHRecord> receivedHRecords = consumer.pollHRecords();
    for(ReceivedHRecord receivedHRecord: receivedHRecords) {
Back to top