Package org.apache.pulsar.client.api
Interface TableViewBuilder<T>
TableViewBuilder
is used to configure and create instances of TableView
.- Since:
- 2.10.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionautoUpdatePartitionsInterval
(int interval, TimeUnit unit) Set the interval of updating partitions (default: 1 minute).create()
Finalize the creation of theTableView
instance.Finalize the creation of theTableView
instance in asynchronous mode.Set theConsumerCryptoFailureAction
to specify.cryptoKeyReader
(CryptoKeyReader cryptoKeyReader) Set theCryptoKeyReader
to decrypt the message payloads.defaultCryptoKeyReader
(String privateKey) Set the default implementation ofCryptoKeyReader
.defaultCryptoKeyReader
(Map<String, String> privateKeys) Set the default implementation ofCryptoKeyReader
.Load the configuration from provided config map.subscriptionName
(String subscriptionName) Set the subscription name of theTableView
.Set the topic name of theTableView
.
-
Method Details
-
loadConf
Load the configuration from provided config map.Example:
Map<String, Object> config = new HashMap<>(); config.put("topicName", "test-topic"); config.put("autoUpdatePartitionsSeconds", "300"); TableViewBuilder<byte[]> builder = ...; builder = builder.loadConf(config); TableView<byte[]> tableView = builder.create();
- Parameters:
config
- configuration to load- Returns:
- the
TableViewBuilder
instance
-
create
Finalize the creation of theTableView
instance.This method will block until the tableView is created successfully or an exception is thrown.
- Returns:
- the
TableView
instance - Throws:
PulsarClientException
- if the tableView creation fails
-
createAsync
CompletableFuture<TableView<T>> createAsync()Finalize the creation of theTableView
instance in asynchronous mode.This method will return a
CompletableFuture
that can be used to access the instance when it's ready.- Returns:
- the
TableView
instance
-
topic
Set the topic name of theTableView
.- Parameters:
topic
- the name of the topic to create theTableView
- Returns:
- the
TableViewBuilder
builder instance
-
autoUpdatePartitionsInterval
Set the interval of updating partitions (default: 1 minute).- Parameters:
interval
- the interval of updating partitionsunit
- the time unit of the interval- Returns:
- the
TableViewBuilder
builder instance
-
subscriptionName
Set the subscription name of theTableView
.- Parameters:
subscriptionName
- the name of the subscription to the topic- Returns:
- the
TableViewBuilder
builder instance
-
cryptoKeyReader
Set theCryptoKeyReader
to decrypt the message payloads.- Parameters:
cryptoKeyReader
- CryptoKeyReader object- Returns:
- the
TableViewBuilder
builder instance
-
defaultCryptoKeyReader
Set the default implementation ofCryptoKeyReader
.Configure the key reader to be used to decrypt message payloads.
- Parameters:
privateKey
- the private key that is always used to decrypt message payloads.- Returns:
- the
TableViewBuilder
builder instance
-
defaultCryptoKeyReader
Set the default implementation ofCryptoKeyReader
.Configure the key reader to be used to decrypt message payloads.
- Parameters:
privateKeys
- the map of private key names and their URIs used to decrypt message payloads.- Returns:
- the
TableViewBuilder
builder instance
-
cryptoFailureAction
Set theConsumerCryptoFailureAction
to specify.- Parameters:
action
- the action to take when the decoding fails- Returns:
- the
TableViewBuilder
builder instance
-