2020-04-16 09:21:23 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package messaging_pb;
|
|
|
|
|
2022-07-29 07:17:28 +00:00
|
|
|
option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb";
|
2022-07-03 07:29:25 +00:00
|
|
|
option java_package = "seaweedfs.mq";
|
2023-12-11 20:05:54 +00:00
|
|
|
option java_outer_classname = "MessageQueueProto";
|
2020-04-16 09:21:23 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
|
|
|
service SeaweedMessaging {
|
|
|
|
|
2022-07-31 20:23:44 +00:00
|
|
|
// control plane
|
2022-07-11 07:20:27 +00:00
|
|
|
rpc FindBrokerLeader (FindBrokerLeaderRequest) returns (FindBrokerLeaderResponse) {
|
|
|
|
}
|
2020-05-05 09:05:28 +00:00
|
|
|
|
2023-09-15 06:49:05 +00:00
|
|
|
// control plane for balancer
|
2023-12-11 20:05:54 +00:00
|
|
|
rpc PublisherToPubBalancer (stream PublisherToPubBalancerRequest) returns (stream PublisherToPubBalancerResponse) {
|
2023-09-15 06:49:05 +00:00
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
rpc BalanceTopics (BalanceTopicsRequest) returns (BalanceTopicsResponse) {
|
2023-09-30 20:18:49 +00:00
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
|
2023-08-21 05:53:05 +00:00
|
|
|
// control plane for topic partitions
|
2023-12-11 20:05:54 +00:00
|
|
|
rpc ListTopics (ListTopicsRequest) returns (ListTopicsResponse) {
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
2023-09-26 22:17:33 +00:00
|
|
|
rpc ConfigureTopic (ConfigureTopicRequest) returns (ConfigureTopicResponse) {
|
2023-09-24 21:22:11 +00:00
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
rpc LookupTopicBrokers (LookupTopicBrokersRequest) returns (LookupTopicBrokersResponse) {
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
|
|
|
|
// invoked by the balancer, running on each broker
|
2023-08-21 05:53:05 +00:00
|
|
|
rpc AssignTopicPartitions (AssignTopicPartitionsRequest) returns (AssignTopicPartitionsResponse) {
|
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
rpc ClosePublishers(ClosePublishersRequest) returns (ClosePublishersResponse) {
|
|
|
|
}
|
|
|
|
rpc CloseSubscribers(CloseSubscribersRequest) returns (CloseSubscribersResponse) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// subscriber connects to broker balancer, which coordinates with the subscribers
|
|
|
|
rpc SubscriberToSubCoordinator (stream SubscriberToSubCoordinatorRequest) returns (stream SubscriberToSubCoordinatorResponse) {
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 20:05:54 +00:00
|
|
|
// data plane for each topic partition
|
2022-07-31 20:23:44 +00:00
|
|
|
rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
|
|
|
|
}
|
2023-08-27 20:13:14 +00:00
|
|
|
rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) {
|
2023-08-26 20:39:21 +00:00
|
|
|
}
|
2020-04-16 09:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
2022-07-10 19:11:37 +00:00
|
|
|
message FindBrokerLeaderRequest {
|
2022-07-11 07:20:27 +00:00
|
|
|
string filer_group = 1;
|
2020-05-05 09:05:28 +00:00
|
|
|
}
|
|
|
|
|
2022-07-10 19:11:37 +00:00
|
|
|
message FindBrokerLeaderResponse {
|
2020-05-05 09:05:28 +00:00
|
|
|
string broker = 1;
|
|
|
|
}
|
2022-07-11 07:20:27 +00:00
|
|
|
|
2023-08-21 05:53:05 +00:00
|
|
|
message Topic {
|
|
|
|
string namespace = 1;
|
|
|
|
string name = 2;
|
|
|
|
}
|
2022-07-11 07:20:27 +00:00
|
|
|
message Partition {
|
|
|
|
int32 ring_size = 1;
|
|
|
|
int32 range_start = 2;
|
|
|
|
int32 range_stop = 3;
|
2023-12-11 20:05:54 +00:00
|
|
|
int64 unix_time_ns = 4;
|
2022-07-11 07:20:27 +00:00
|
|
|
}
|
2022-07-31 20:23:44 +00:00
|
|
|
|
2023-09-15 06:49:05 +00:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
message BrokerStats {
|
2023-09-19 21:02:08 +00:00
|
|
|
int32 cpu_usage_percent = 1;
|
|
|
|
map<string, TopicPartitionStats> stats = 2;
|
2023-09-15 06:49:05 +00:00
|
|
|
}
|
2023-09-19 21:02:08 +00:00
|
|
|
message TopicPartitionStats {
|
|
|
|
Topic topic = 1;
|
|
|
|
Partition partition = 2;
|
|
|
|
int32 consumer_count = 3;
|
|
|
|
bool is_leader = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-12-11 20:05:54 +00:00
|
|
|
message PublisherToPubBalancerRequest {
|
2023-09-15 06:49:05 +00:00
|
|
|
message InitMessage {
|
|
|
|
string broker = 1;
|
|
|
|
}
|
|
|
|
oneof message {
|
|
|
|
InitMessage init = 1;
|
|
|
|
BrokerStats stats = 2;
|
|
|
|
}
|
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
message PublisherToPubBalancerResponse {
|
2023-09-15 06:49:05 +00:00
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
|
|
|
|
message BalanceTopicsRequest {
|
|
|
|
}
|
|
|
|
message BalanceTopicsResponse {
|
|
|
|
}
|
|
|
|
|
2023-09-15 06:49:05 +00:00
|
|
|
//////////////////////////////////////////////////
|
2023-09-26 22:17:33 +00:00
|
|
|
message ConfigureTopicRequest {
|
2023-09-24 21:22:11 +00:00
|
|
|
Topic topic = 1;
|
|
|
|
int32 partition_count = 2;
|
|
|
|
}
|
2023-09-26 22:17:33 +00:00
|
|
|
message ConfigureTopicResponse {
|
2023-09-24 21:22:11 +00:00
|
|
|
repeated BrokerPartitionAssignment broker_partition_assignments = 2;
|
|
|
|
}
|
2023-09-25 04:19:51 +00:00
|
|
|
message ListTopicsRequest {
|
|
|
|
}
|
|
|
|
message ListTopicsResponse {
|
|
|
|
repeated Topic topics = 1;
|
|
|
|
}
|
2023-08-28 01:59:04 +00:00
|
|
|
message LookupTopicBrokersRequest {
|
2023-08-21 05:53:05 +00:00
|
|
|
Topic topic = 1;
|
|
|
|
bool is_for_publish = 2;
|
|
|
|
}
|
2023-08-28 01:59:04 +00:00
|
|
|
message LookupTopicBrokersResponse {
|
2023-08-21 05:53:05 +00:00
|
|
|
Topic topic = 1;
|
2023-08-28 01:59:04 +00:00
|
|
|
repeated BrokerPartitionAssignment broker_partition_assignments = 2;
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
2023-08-28 01:59:04 +00:00
|
|
|
message BrokerPartitionAssignment {
|
|
|
|
Partition partition = 1;
|
|
|
|
string leader_broker = 2;
|
|
|
|
repeated string follower_brokers = 3;
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message AssignTopicPartitionsRequest {
|
|
|
|
Topic topic = 1;
|
2023-08-28 01:59:04 +00:00
|
|
|
repeated BrokerPartitionAssignment broker_partition_assignments = 2;
|
2023-08-21 05:53:05 +00:00
|
|
|
bool is_leader = 3;
|
2023-12-11 20:05:54 +00:00
|
|
|
bool is_draining = 4;
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
|
|
|
message AssignTopicPartitionsResponse {
|
|
|
|
}
|
|
|
|
|
2023-12-11 20:05:54 +00:00
|
|
|
message SubscriberToSubCoordinatorRequest {
|
|
|
|
message InitMessage {
|
|
|
|
string consumer_group = 1;
|
2023-12-28 19:56:37 +00:00
|
|
|
string consumer_group_instance_id = 2;
|
2023-12-11 20:05:54 +00:00
|
|
|
Topic topic = 3;
|
|
|
|
}
|
|
|
|
message AckMessage {
|
|
|
|
Partition partition = 1;
|
|
|
|
int64 ts_ns = 2;
|
|
|
|
}
|
|
|
|
oneof message {
|
|
|
|
InitMessage init = 1;
|
|
|
|
AckMessage ack = 2;
|
|
|
|
}
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
message SubscriberToSubCoordinatorResponse {
|
|
|
|
message AssignedPartition {
|
|
|
|
Partition partition = 1;
|
|
|
|
int64 ts_ns = 2;
|
2023-12-29 04:35:15 +00:00
|
|
|
string broker = 3;
|
2023-12-11 20:05:54 +00:00
|
|
|
}
|
|
|
|
message Assignment {
|
|
|
|
int64 generation = 1;
|
|
|
|
repeated AssignedPartition assigned_partitions = 2;
|
|
|
|
}
|
|
|
|
oneof message {
|
|
|
|
Assignment assignment = 1;
|
|
|
|
}
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
|
|
|
|
2022-07-31 20:23:44 +00:00
|
|
|
//////////////////////////////////////////////////
|
2023-08-26 20:39:21 +00:00
|
|
|
message DataMessage {
|
|
|
|
bytes key = 1;
|
|
|
|
bytes value = 2;
|
2023-12-11 20:05:54 +00:00
|
|
|
int64 ts_ns = 3;
|
2023-08-26 20:39:21 +00:00
|
|
|
}
|
2022-07-31 20:23:44 +00:00
|
|
|
message PublishRequest {
|
|
|
|
message InitMessage {
|
2023-08-26 20:39:21 +00:00
|
|
|
Topic topic = 1;
|
|
|
|
Partition partition = 2;
|
2023-09-07 05:39:46 +00:00
|
|
|
int32 ack_interval = 3;
|
2023-08-21 05:53:05 +00:00
|
|
|
}
|
|
|
|
oneof message {
|
|
|
|
InitMessage init = 1;
|
|
|
|
DataMessage data = 2;
|
|
|
|
}
|
|
|
|
int64 sequence = 3;
|
2022-07-31 20:23:44 +00:00
|
|
|
}
|
|
|
|
message PublishResponse {
|
|
|
|
int64 ack_sequence = 1;
|
2023-08-21 05:53:05 +00:00
|
|
|
string error = 2;
|
2023-12-11 20:05:54 +00:00
|
|
|
bool should_close = 3;
|
2022-07-31 20:23:44 +00:00
|
|
|
}
|
2023-08-26 20:39:21 +00:00
|
|
|
message SubscribeRequest {
|
2023-10-01 04:47:57 +00:00
|
|
|
message InitMessage {
|
2023-09-01 07:36:51 +00:00
|
|
|
string consumer_group = 1;
|
|
|
|
string consumer_id = 2;
|
2023-09-05 04:43:50 +00:00
|
|
|
string client_id = 3;
|
2023-09-30 20:18:49 +00:00
|
|
|
Topic topic = 4;
|
|
|
|
Partition partition = 5;
|
2023-09-01 07:36:51 +00:00
|
|
|
oneof offset {
|
2023-10-01 04:47:57 +00:00
|
|
|
int64 start_offset = 6;
|
|
|
|
int64 start_timestamp_ns = 7;
|
2023-09-01 07:36:51 +00:00
|
|
|
}
|
2023-10-01 04:47:57 +00:00
|
|
|
string filter = 8;
|
2023-09-30 20:18:49 +00:00
|
|
|
}
|
|
|
|
message AckMessage {
|
|
|
|
int64 sequence = 1;
|
|
|
|
}
|
|
|
|
oneof message {
|
2023-10-01 04:47:57 +00:00
|
|
|
InitMessage init = 1;
|
|
|
|
AckMessage ack = 2;
|
2023-08-26 20:39:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
message SubscribeResponse {
|
|
|
|
message CtrlMessage {
|
|
|
|
string error = 1;
|
2023-09-30 20:18:49 +00:00
|
|
|
bool is_end_of_stream = 2;
|
|
|
|
bool is_end_of_topic = 3;
|
2023-08-26 20:39:21 +00:00
|
|
|
}
|
|
|
|
oneof message {
|
|
|
|
CtrlMessage ctrl = 1;
|
|
|
|
DataMessage data = 2;
|
|
|
|
}
|
|
|
|
}
|
2023-12-11 20:05:54 +00:00
|
|
|
message ClosePublishersRequest {
|
|
|
|
Topic topic = 1;
|
|
|
|
int64 unix_time_ns = 2;
|
|
|
|
}
|
|
|
|
message ClosePublishersResponse {
|
|
|
|
}
|
|
|
|
message CloseSubscribersRequest {
|
|
|
|
Topic topic = 1;
|
|
|
|
int64 unix_time_ns = 2;
|
|
|
|
}
|
|
|
|
message CloseSubscribersResponse {
|
|
|
|
}
|