Skip to main content

Work with TableView

After setting up your clients, you can explore more to start working with TableView.

Configure TableView

The following is an example of how to configure a TableView.

TableView<String> tv = client.newTableViewBuilder(Schema.STRING)
.topic("my-tableview")
.create()

You can use the available parameters in the loadConf configuration or related API to customize your TableView.

NameTypeRequired?
Description
Default
topicstringyesThe topic name of the TableView.N/A
autoUpdatePartitionIntervalintnoThe interval to check for newly added partitions.60 (seconds)
subscriptionNamestringnoThe subscription name of the TableView.null

Register listeners

You can register listeners for both existing messages on a topic and new messages coming into the topic by using forEachAndListen, and specify to perform operations for all existing messages by using forEach.

The following is an example of how to register listeners with TableView.

// Register listeners for all existing and incoming messages
tv.forEachAndListen((key, value) -> /*operations on all existing and incoming messages*/)

// Register action for all existing messages
tv.forEach((key, value) -> /*operations on all existing messages*/)