reship events

This commit is contained in:
Asim Aslam
2021-11-02 16:26:07 +00:00
parent ff20739cb5
commit c63c60a7e5
5 changed files with 456 additions and 66 deletions

View File

@@ -8,6 +8,16 @@ import "google/protobuf/struct.proto";
service Event {
rpc Publish(PublishRequest) returns (PublishResponse) {}
rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) {}
rpc Read(ReadRequest) returns (ReadResponse) {}
}
message Ev {
// event id
string id = 1;
// event timestamp
string timestamp = 2;
// event message
google.protobuf.Struct message = 3;
}
// Publish a message to the event stream.
@@ -15,7 +25,7 @@ message PublishRequest {
// The topic to publish to
string topic = 1;
// The json message to publish
google.protobuf.Struct message = 2;
google.protobuf.Struct message = 4;
}
message PublishResponse {}
@@ -26,12 +36,33 @@ message SubscribeRequest {
string topic = 1;
// Optional group for the subscription
string group = 2;
// Optional offset to read from e.g "2006-01-02T15:04:05.999Z07:00"
string offset = 3;
}
// A blocking event will be returned in response.
message SubscribeResponse {
// The topic subscribed to
string topic = 1;
// Unique message id
string id = 2;
// Timestamp of publishing
string timestamp = 3;
// The next json message on the topic
google.protobuf.Struct message = 2;
google.protobuf.Struct message = 4;
}
// Read stored events
message ReadRequest {
// topic to read from
string topic = 1;
// number of events to read; default 25
int32 limit = 2;
// offset for the events; default 0
int32 offset = 3;
}
message ReadResponse {
// the events
repeated Ev events = 1;
}