-
Book Overview & Buying
-
Table Of Contents
Microservices Communication in .NET Using gRPC
By :
If you want to minimize a Profobuf message's size while fitting as much data as possible into it, you can convert your data into a binary form. In Protobuf, there is a bytes data type that exists specifically for this.
Even though this data type is represented by the ByteString type from the Google.Protobuf library in C#, there are multiple ways of inserting a standard byte array into the fields of this type, which makes it compatible with any byte-processing functionality available in C#.
Let's have a look at various ways of writing data into this field and reading data from it.
In the GrpcDependencies project, open the performance.proto file inside the Protos folder and add the following fields to the PerformanceStatusResponse message definition:
bytes data_load_1 = 5; bytes data_load_2 = 6;
Now, let's apply some modifications to the PerformanceMonitor class from...