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.

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