You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.2 KiB

  1. syntax = "proto3";
  2. package messaging_pb;
  3. option java_package = "seaweedfs.client";
  4. option java_outer_classname = "MessagingProto";
  5. //////////////////////////////////////////////////
  6. service SeaweedMessaging {
  7. rpc Subscribe (stream SubscriberMessage) returns (stream BrokerMessage) {
  8. }
  9. rpc Publish (stream PublishRequest) returns (stream PublishResponse) {
  10. }
  11. rpc DeleteTopic (DeleteTopicRequest) returns (DeleteTopicResponse) {
  12. }
  13. rpc ConfigureTopic (ConfigureTopicRequest) returns (ConfigureTopicResponse) {
  14. }
  15. rpc GetTopicConfiguration (GetTopicConfigurationRequest) returns (GetTopicConfigurationResponse) {
  16. }
  17. rpc FindBroker (FindBrokerRequest) returns (FindBrokerResponse) {
  18. }
  19. }
  20. //////////////////////////////////////////////////
  21. message SubscriberMessage {
  22. message InitMessage {
  23. string namespace = 1;
  24. string topic = 2;
  25. int32 partition = 3;
  26. enum StartPosition {
  27. LATEST = 0; // Start at the newest message
  28. EARLIEST = 1; // Start at the oldest message
  29. TIMESTAMP = 2; // Start after a specified timestamp, exclusive
  30. }
  31. StartPosition startPosition = 4; // Where to begin consuming from
  32. int64 timestampNs = 5; // timestamp in nano seconds
  33. string subscriber_id = 6; // uniquely identify a subscriber to track consumption
  34. }
  35. InitMessage init = 1;
  36. message AckMessage {
  37. int64 message_id = 1;
  38. }
  39. AckMessage ack = 2;
  40. bool is_close = 3;
  41. }
  42. message Message {
  43. int64 event_time_ns = 1 [jstype = JS_STRING];
  44. bytes key = 2; // Message key
  45. bytes value = 3; // Message payload
  46. map<string, bytes> headers = 4; // Message headers
  47. bool is_close = 5;
  48. }
  49. message BrokerMessage {
  50. Message data = 1;
  51. }
  52. message PublishRequest {
  53. message InitMessage {
  54. string namespace = 1; // only needed on the initial request
  55. string topic = 2; // only needed on the initial request
  56. int32 partition = 3;
  57. }
  58. InitMessage init = 1;
  59. Message data = 2;
  60. }
  61. message PublishResponse {
  62. message ConfigMessage {
  63. int32 partition_count = 1;
  64. }
  65. ConfigMessage config = 1;
  66. message RedirectMessage {
  67. string new_broker = 1;
  68. }
  69. RedirectMessage redirect = 2;
  70. bool is_closed = 3;
  71. }
  72. message DeleteTopicRequest {
  73. string namespace = 1;
  74. string topic = 2;
  75. }
  76. message DeleteTopicResponse {
  77. }
  78. message ConfigureTopicRequest {
  79. string namespace = 1;
  80. string topic = 2;
  81. TopicConfiguration configuration = 3;
  82. }
  83. message ConfigureTopicResponse {
  84. }
  85. message GetTopicConfigurationRequest {
  86. string namespace = 1;
  87. string topic = 2;
  88. }
  89. message GetTopicConfigurationResponse {
  90. TopicConfiguration configuration = 1;
  91. }
  92. message FindBrokerRequest {
  93. string namespace = 1;
  94. string topic = 2;
  95. int32 parition = 3;
  96. }
  97. message FindBrokerResponse {
  98. string broker = 1;
  99. }
  100. message TopicConfiguration {
  101. int32 partition_count = 1;
  102. string collection = 2;
  103. string replication = 3;
  104. bool is_transient = 4;
  105. enum Partitioning {
  106. NonNullKeyHash = 0; // If not null, hash by key value. If null, round robin
  107. KeyHash = 1; // hash by key value
  108. RoundRobin = 2; // round robin pick one partition
  109. }
  110. Partitioning partitoning = 5;
  111. }