Safer usage of protobuf stream api