Package io.hstream
Interface HStreamClient
-
- All Superinterfaces:
AutoCloseable
public interface HStreamClient extends AutoCloseable
A client for the HStreamDB.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidalterConnectorConfig(String name, String config)static HStreamClientBuilderbuilder()ConnectorcreateConnector(CreateConnectorRequest request)QuerycreateQuery(String name, String sql)voidcreateStream(Stream stream)Create a new stream.voidcreateStream(String stream)Create a new stream with 1 replicas.voidcreateStream(String stream, short replicationFactor)Create a new stream.voidcreateStream(String stream, short replicationFactor, int shardCount)Create a new stream.voidcreateStream(String stream, short replicationFactor, int shardCount, int backlogDuration)Create a new stream.voidcreateSubscription(Subscription subscription)Create a new Subscription.voiddeleteConnector(String name)voiddeleteQuery(String name)voiddeleteStream(String stream)Delete the specified stream with streamName.voiddeleteStream(String stream, boolean force)Delete the specified stream with streamName.voiddeleteSubscription(String subscriptionId)Delete the specified subscription with subscriptionId.voiddeleteSubscription(String subscriptionId, boolean force)Delete the specified subscription with subscriptionId.voiddeleteView(String name)ClusterdescribeCluster()List<HRecord>executeViewQuery(String sql)only support to execute view query, e.g.ConnectorgetConnector(String name)StringgetConnectorLogs(String name, int begin, int count)StringgetConnectorSpec(String type, String target)QuerygetQuery(String name)GetStreamResponsegetStream(String streamName)GetSubscriptionResponsegetSubscription(String subscriptionId)StringgetTailRecordId(String streamName, long shardId)ViewgetView(String name)List<Connector>listConnectors()List<ConsumerInformation>listConsumers(String subscriptionId)List<Query>listQueries()List<Shard>listShards(String streamName)List shards in a stream.List<Stream>listStreams()List all streams.List<Subscription>listSubscriptions()List all subscriptions.List<View>listViews()BufferedProducerBuildernewBufferedProducer()ConsumerBuildernewConsumer()ProducerBuildernewProducer()QueryerBuildernewQueryer()Deprecated.ReaderBuildernewReader()Deprecated.StreamKeyReaderBuildernewStreamKeyReader()StreamShardReaderBuildernewStreamShardReader()voidterminateQuery(String name)voidtrimShards(String stream, List<String> records)-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
builder
static HStreamClientBuilder builder()
- Returns:
- a
HStreamClientBuilder
-
newProducer
ProducerBuilder newProducer()
- Returns:
- a
ProducerBuilder
-
newBufferedProducer
BufferedProducerBuilder newBufferedProducer()
-
newConsumer
ConsumerBuilder newConsumer()
- Returns:
- a
ConsumerBuilder
-
newQueryer
@Deprecated QueryerBuilder newQueryer()
Deprecated.
-
newReader
@Deprecated ReaderBuilder newReader()
Deprecated.
-
newStreamShardReader
StreamShardReaderBuilder newStreamShardReader()
-
newStreamKeyReader
StreamKeyReaderBuilder newStreamKeyReader()
-
createStream
void createStream(String stream)
Create a new stream with 1 replicas.- Parameters:
stream- the name of stream
-
createStream
void createStream(String stream, short replicationFactor)
Create a new stream.- Parameters:
stream- the name of the streamreplicationFactor- replication factor of the stream
-
createStream
void createStream(String stream, short replicationFactor, int shardCount)
Create a new stream.- Parameters:
stream- the name of the streamreplicationFactor- replication factor of the streamshardCount- number of shards in the stream
-
createStream
void createStream(String stream, short replicationFactor, int shardCount, int backlogDuration)
Create a new stream.- Parameters:
stream- the name of the streamreplicationFactor- replication factor of the streamshardCount- number of shards in the streambacklogDuration- backlog duration(in seconds) of the stream
-
createStream
void createStream(Stream stream)
Create a new stream.- Parameters:
stream- Stream Object, you should useStream.Builderto build it.
-
listShards
List<Shard> listShards(String streamName)
List shards in a stream.- Parameters:
streamName- the name of the stream- Returns:
- a list of
Shards.
-
deleteStream
void deleteStream(String stream)
Delete the specified stream with streamName.- Parameters:
stream- the name of stream
-
deleteStream
void deleteStream(String stream, boolean force)
Delete the specified stream with streamName.- Parameters:
stream- the name of streamforce- the flag whether to enable force deletion
-
getStream
GetStreamResponse getStream(String streamName)
-
createSubscription
void createSubscription(Subscription subscription)
Create a new Subscription.- Parameters:
subscription-Subscription
-
listSubscriptions
List<Subscription> listSubscriptions()
List all subscriptions.- Returns:
- a list of
Subscriptions.
-
getSubscription
GetSubscriptionResponse getSubscription(String subscriptionId)
-
deleteSubscription
void deleteSubscription(String subscriptionId)
Delete the specified subscription with subscriptionId.- Parameters:
subscriptionId- the id of the subscription to be deleted
-
deleteSubscription
void deleteSubscription(String subscriptionId, boolean force)
Delete the specified subscription with subscriptionId.- Parameters:
subscriptionId- the id of the subscription to be deletedforce- the flag whether to enable force deletion
-
describeCluster
Cluster describeCluster()
-
deleteQuery
void deleteQuery(String name)
-
terminateQuery
void terminateQuery(String name)
-
deleteView
void deleteView(String name)
-
executeViewQuery
List<HRecord> executeViewQuery(String sql)
only support to execute view query, e.g. `select * from view1 where id = 1;`- Parameters:
sql- select view sql- Returns:
- all HRecord result set
-
listConsumers
List<ConsumerInformation> listConsumers(String subscriptionId)
-
createConnector
Connector createConnector(CreateConnectorRequest request)
-
deleteConnector
void deleteConnector(String name)
-
-