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.

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