File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed
server/src/main/java/com/hedera/block/server/observe/mediate Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
3
echo " Starting consumer..."
4
- starting_block=$1
5
4
6
- payload=" {\" id\" : $starting_block }"
5
+ # Set the gRPC server address and method
6
+ GRPC_SERVER=" localhost:8080"
7
+ GRPC_METHOD=" BlockStreamGrpc/StreamSource"
7
8
8
- grpcurl -vv -plaintext -proto ./protos/src/main/protobuf/blockstream.proto -d " $payload " localhost:8080 BlockStreamGrpc/StreamSource
9
+ # Function to handle received messages and send replies
10
+ handle_streaming () {
11
+ while read -r line; do
12
+ id=$( echo " $line " | jq -r ' .id' )
13
+ if [[ $id != " null" ]]; then
14
+ echo " {\" id\" : $id }"
15
+ fi
16
+ done
17
+ }
9
18
10
- echo " Finished"
19
+ # Trap SIGINT to clean up
20
+ trap " echo 'Received SIGINT, stopping...'; exit 0" SIGINT
11
21
22
+ payload=" {\" id\" : 0}"
23
+
24
+ # grpcurl -vv -plaintext -proto ./protos/src/main/protobuf/blockstream.proto -d "$payload" localhost:8080 BlockStreamGrpc/StreamSource
25
+
26
+ # Initiate the bidirectional streaming connection
27
+ grpcurl -vv -plaintext -proto ./protos/src/main/protobuf/blockstream.proto -d " $payload " $GRPC_SERVER $GRPC_METHOD
28
+ #{} # Initial empty request if needed
29
+ EOF | handle_streaming | grpcurl -plaintext -d @ $GRPC_SERVER $GRPC_METHOD --format json
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public void onNext(BlockStreamServiceGrpcProto.Block block) {
54
54
}
55
55
56
56
// Persist the block
57
- blockPersistenceHandler .persist (block );
57
+ // blockPersistenceHandler.persist(block);
58
58
}
59
59
60
60
@ Override
You can’t perform that action at this time.
0 commit comments