Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Protocol buffers example
syntax = "proto3";
package sensors;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "EventHubsThroughput.Models.Protobuf";
enum SensorType {
UNKNOWN = 0;
SEISMIC = 1;
WEATHER = 2;
OCEANIC = 3;
}
message WeatherSensorReading {
string SensorId = 1;
float Temperature = 3;
float Precipitation = 4;
float Humidity = 5;
}
message SeismicSensorReading {
string SensorId = 1;
bool QuakeObserved = 3;
float Magnitude = 4;
}
message Location {
string City = 1;
string Locality = 2;
string ZipCode = 3;
}
message Metrics {
google.protobuf.Timestamp EnqueueTime = 1;
google.protobuf.Timestamp Timestamp = 2;
}
message WeatherReadingBatch {
repeated WeatherSensorReading SensorReadings = 1;
}
message SeismicReadingBatch {
repeated SeismicSensorReading SensorReadings = 1;
}
message LocationEnrichedWeatherData {
Location Location = 1;
Metrics Metrics = 2;
WeatherSensorReading SensorReading = 3;
}
message LocationEnrichedSeismicData {
Location Location = 1;
Metrics Metrics = 2;
SeismicSensorReading SensorReading = 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.