File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
client/src/main/java/io/hstream Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,20 @@ static HStreamClientBuilder builder() {
2020 /** @return the {@link QueryerBuilder}. */
2121 QueryerBuilder newQueryer ();
2222
23- /** @param stream the name of stream. */
23+ /**
24+ * create a new stream with 3 replicas.
25+ *
26+ * @param stream the name of stream.
27+ */
2428 void createStream (String stream );
2529
30+ /**
31+ * create a new stream.
32+ *
33+ * @param stream the name of stream.
34+ */
35+ void createStream (String stream , short replicationFactor );
36+
2637 /**
2738 * Delete specified stream with streamName.
2839 *
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ public class HStreamClientImpl implements HStreamClient {
2323 private final HStreamApiGrpc .HStreamApiStub stub ;
2424 private final HStreamApiGrpc .HStreamApiBlockingStub blockingStub ;
2525
26+ private static final short DEFAULT_STREAM_REPLICATOR = 3 ;
27+
2628 public HStreamClientImpl (String serviceUrl ) {
2729 ManagedChannel channel = ManagedChannelBuilder .forTarget (serviceUrl ).usePlaintext ().build ();
2830 this .managedChannel = channel ;
@@ -47,8 +49,12 @@ public QueryerBuilder newQueryer() {
4749
4850 @ Override
4951 public void createStream (String streamName ) {
50- Stream stream = new Stream (streamName , 3 );
52+ createStream (streamName , DEFAULT_STREAM_REPLICATOR );
53+ }
5154
55+ @ Override
56+ public void createStream (String streamName , short replicationFactor ) {
57+ Stream stream = new Stream (streamName , replicationFactor );
5258 blockingStub .createStream (GrpcUtils .streamToGrpc (stream ));
5359 }
5460
You can’t perform that action at this time.
0 commit comments