Skip to content

Commit 10d6b85

Browse files
fix: added detail about dropping BlockItems when a consumer subscribes until the next Block arrives
Signed-off-by: Matt Peterson <[email protected]>
1 parent 8c5794e commit 10d6b85

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

server/docs/design/bidi-producer-consumers-streaming.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ point for custom logic is an implementation of `GrpcService`.
1717
## Goals
1818

1919
1) Consumers must be able to dynamically subscribe and unsubscribe from the live stream of BlockItems emitted by the
20-
producer.
20+
producer. When a consumer subscribes to the stream, they will begin receiving BlockItems at the start of the next Block.
21+
BlockItems transiting before the next Block will be discarded and not sent to the downstream consumer.
2122
2) Correct, in-order streaming delivery of BlockItems from a producer to all registered consumers.
2223
3) Minimize latency between the producer and consumers.
2324
4) Minimize CPU resources consumed by the producer and consumers.
@@ -29,18 +30,18 @@ point for custom logic is an implementation of `GrpcService`.
2930
**BlockItem** - The BlockItem is the primary data structure passed between the producer, the `hedera-block-node`
3031
and consumers. A defined sequence of BlockItems represent a Block when stored on the `hedera-block-node`.
3132

32-
**Bidirectional Streaming** - Bidirectional streaming is an [HTTP/2 feature](https://datatracker.ietf.org/doc/html/rfc9113#name-streams-and-multiplexing) allowing both a client and a server to emit
33-
a continuous stream of frames without waiting for responses. In this way, gRPC services can be used to efficiently
34-
transmit a continuous flow of BlockItem messages while the HTTP/2 connection is open.
33+
**Bidirectional Streaming** - Bidirectional streaming is an [HTTP/2 feature](https://datatracker.ietf.org/doc/html/rfc9113#name-streams-and-multiplexing)
34+
allowing both a client and a server emit a continuous stream of frames without waiting for responses. In this way, gRPC
35+
services can be used to efficiently transmit a continuous flow of BlockItem messages while the HTTP/2 connection is open.
3536

3637
**Producer StreamObserver** - The Producer StreamObserver is a custom implementation of the [gRPC StreamObserver
37-
interface](https://github.com/grpc/grpc-java/blob/0ff3f8e4ac4c265e91b4a0379a32cf25a0a2b2f7/stub/src/main/java/io/grpc/stub/StreamObserver.java#L45) used by Helidon. It is initialized by the BlockItemStreamService (see Entities section). Helidon invokes the Producer
38-
StreamObserver at runtime when the producer sends a new BlockItem to the `StreamSink` gRPC service.
38+
interface](https://github.com/grpc/grpc-java/blob/0ff3f8e4ac4c265e91b4a0379a32cf25a0a2b2f7/stub/src/main/java/io/grpc/stub/StreamObserver.java#L45) used by Helidon. It is initialized by the BlockItemStreamService (see Entities section). Helidon invokes
39+
the Producer StreamObserver at runtime when the producer sends a new BlockItem to the `StreamSink` gRPC service.
3940

4041
**Consumer StreamObserver** - The Consumer StreamObserver is a custom implementation of the [gRPC StreamObserver
41-
interface](https://github.com/grpc/grpc-java/blob/0ff3f8e4ac4c265e91b4a0379a32cf25a0a2b2f7/stub/src/main/java/io/grpc/stub/StreamObserver.java#L45) used by Helidon. It is initialized by the BlockItemStreamService (see Entities section). Helidon invokes the Consumer
42-
StreamObserver at runtime when the downstream consumer of the `StreamSource` gRPC service sends HTTP/2 responses to
43-
sent BlockItems.
42+
interface](https://github.com/grpc/grpc-java/blob/0ff3f8e4ac4c265e91b4a0379a32cf25a0a2b2f7/stub/src/main/java/io/grpc/stub/StreamObserver.java#L45) used by Helidon. It is initialized by the BlockItemStreamService (see Entities section). Helidon invokes
43+
the Consumer StreamObserver at runtime when the downstream consumer of the `StreamSource` gRPC service sends HTTP/2
44+
responses to sent BlockItems.
4445

4546
**subscribe** - Consumers calling the `StreamSource` gRPC service must be affiliated or subscribed with a producer to
4647
receive a live stream of BlockItems from the `hedera-block-node`.

0 commit comments

Comments
 (0)