2020-04-16 09:21:23 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package messaging_pb;
|
|
|
|
|
|
|
|
option java_package = "seaweedfs.client";
|
|
|
|
option java_outer_classname = "MessagingProto";
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
|
|
|
service SeaweedMessaging {
|
|
|
|
|
2020-04-16 10:29:57 +00:00
|
|
|
rpc Subscribe (stream SubscriberMessage) returns (stream BrokerMessage) {
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc ConfigureTopic (ConfigureTopicRequest) returns (ConfigureTopicResponse) {
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc GetTopicConfiguration (GetTopicConfigurationRequest) returns (GetTopicConfigurationResponse) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
2020-04-16 10:29:57 +00:00
|
|
|
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;
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
2020-04-16 10:29:57 +00:00
|
|
|
AckMessage ack = 2;
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Message {
|
2020-04-20 06:37:04 +00:00
|
|
|
int64 event_time_ns = 1 [jstype = JS_STRING];
|
2020-04-16 09:21:23 +00:00
|
|
|
bytes key = 2; // Message key
|
|
|
|
bytes value = 3; // Message payload
|
|
|
|
map<string, bytes> headers = 4; // Message headers
|
|
|
|
}
|
|
|
|
|
2020-04-16 10:29:57 +00:00
|
|
|
message BrokerMessage {
|
|
|
|
Message data = 1;
|
|
|
|
message RedirectMessage {
|
|
|
|
string new_broker = 1;
|
|
|
|
}
|
|
|
|
RedirectMessage redirect = 2;
|
|
|
|
}
|
|
|
|
|
2020-04-16 09:21:23 +00:00
|
|
|
message PublishRequest {
|
2020-04-16 10:29:57 +00:00
|
|
|
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;
|
2020-04-20 06:37:04 +00:00
|
|
|
Message data = 2;
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message PublishResponse {
|
2020-04-16 10:29:57 +00:00
|
|
|
message ConfigMessage {
|
|
|
|
int32 partition_count = 1;
|
|
|
|
}
|
|
|
|
ConfigMessage config = 1;
|
|
|
|
message RedirectMessage {
|
|
|
|
string new_broker = 1;
|
|
|
|
}
|
|
|
|
RedirectMessage redirect = 2;
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message ConfigureTopicRequest {
|
|
|
|
string namespace = 1;
|
|
|
|
string topic = 2;
|
2020-04-17 09:29:38 +00:00
|
|
|
TopicConfiguration configuration = 3;
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
|
|
|
message ConfigureTopicResponse {
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetTopicConfigurationRequest {
|
|
|
|
string namespace = 1;
|
|
|
|
string topic = 2;
|
|
|
|
}
|
|
|
|
message GetTopicConfigurationResponse {
|
2020-04-17 09:29:38 +00:00
|
|
|
TopicConfiguration configuration = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TopicConfiguration {
|
|
|
|
int32 partition_count = 1;
|
|
|
|
string collection = 2;
|
|
|
|
string replication = 3;
|
2020-04-19 10:03:40 +00:00
|
|
|
bool is_transient = 4;
|
2020-04-21 07:59:55 +00:00
|
|
|
enum Partitioning {
|
|
|
|
NonNullKeyHash = 0; // If not null, hash by key value. If null, round robin
|
|
|
|
KeyHash = 1; // hash by key value
|
|
|
|
RoundRobin = 2; // round robin pick one partition
|
|
|
|
}
|
|
|
|
Partitioning partitoning = 5;
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|