seaweedfs/weed/pb/messaging.proto
2020-04-17 02:29:38 -07:00

111 lines
2.8 KiB
Protocol Buffer

syntax = "proto3";
package messaging_pb;
option java_package = "seaweedfs.client";
option java_outer_classname = "MessagingProto";
//////////////////////////////////////////////////
service SeaweedMessaging {
rpc Subscribe (stream SubscriberMessage) returns (stream BrokerMessage) {
}
rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
}
rpc ConfigureTopic (ConfigureTopicRequest) returns (ConfigureTopicResponse) {
}
rpc GetTopicConfiguration (GetTopicConfigurationRequest) returns (GetTopicConfigurationResponse) {
}
}
//////////////////////////////////////////////////
message SubscriberMessage {
message InitMessage {
string namespace = 1;
string topic = 2;
int32 partition = 3;
enum StartPosition {
LATEST = 0; // Start at the newest message
EARLIEST = 1; // Start at the oldest message
TIMESTAMP = 2; // Start after a specified timestamp, exclusive
}
StartPosition startPosition = 4; // Where to begin consuming from
int64 timestampNs = 5; // timestamp in nano seconds
string subscriber_id = 6; // uniquely identify a subscriber to track consumption
}
InitMessage init = 1;
message AckMessage {
int64 message_id = 1;
}
AckMessage ack = 2;
}
message Message {
int64 timestamp = 1 [jstype = JS_STRING]; // When the message was received by the broker
bytes key = 2; // Message key
bytes value = 3; // Message payload
map<string, bytes> headers = 4; // Message headers
}
message BrokerMessage {
Message data = 1;
message RedirectMessage {
string new_broker = 1;
}
RedirectMessage redirect = 2;
}
message PublishRequest {
message InitMessage {
string namespace = 1; // only needed on the initial request
string topic = 2; // only needed on the initial request
int32 partition = 3;
}
InitMessage init = 1;
message DataMessage {
bytes key = 1; // Message key
bytes value = 2; // Message payload
map<string, bytes> headers = 3; // Message headers
}
DataMessage data = 2;
}
message PublishResponse {
message ConfigMessage {
int32 partition_count = 1;
}
ConfigMessage config = 1;
message RedirectMessage {
string new_broker = 1;
}
RedirectMessage redirect = 2;
}
message ConfigureTopicRequest {
string namespace = 1;
string topic = 2;
TopicConfiguration configuration = 3;
}
message ConfigureTopicResponse {
}
message GetTopicConfigurationRequest {
string namespace = 1;
string topic = 2;
}
message GetTopicConfigurationResponse {
TopicConfiguration configuration = 1;
}
message TopicConfiguration {
int32 partition_count = 1;
string collection = 2;
string replication = 3;
}