Skip to content

Instantly share code, notes, and snippets.

@paulbatum
Created September 14, 2017 19:45
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save paulbatum/c918e19cadb43fdfcce978d58d97d235 to your computer and use it in GitHub Desktop.
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