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.

116 lines
2.9 KiB

5 years ago
5 years ago
5 years ago
  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 RawData {
  38. bytes key = 1; // Message key
  39. bytes value = 2; // Message payload
  40. map<string, bytes> headers = 3; // Message headers
  41. }
  42. message Message {
  43. int64 timestamp = 1 [jstype = JS_STRING]; // When the message was received by the broker
  44. bytes key = 2; // Message key
  45. bytes value = 3; // Message payload
  46. map<string, bytes> headers = 4; // Message headers
  47. }
  48. message BrokerMessage {
  49. Message data = 1;
  50. message RedirectMessage {
  51. string new_broker = 1;
  52. }
  53. RedirectMessage redirect = 2;
  54. }
  55. message PublishRequest {
  56. message InitMessage {
  57. string namespace = 1; // only needed on the initial request
  58. string topic = 2; // only needed on the initial request
  59. int32 partition = 3;
  60. }
  61. InitMessage init = 1;
  62. message RawData {
  63. bytes key = 1; // Message key
  64. bytes value = 2; // Message payload
  65. map<string, bytes> headers = 3; // Message headers
  66. }
  67. RawData data = 2;
  68. }
  69. message PublishResponse {
  70. message ConfigMessage {
  71. int32 partition_count = 1;
  72. }
  73. ConfigMessage config = 1;
  74. message RedirectMessage {
  75. string new_broker = 1;
  76. }
  77. RedirectMessage redirect = 2;
  78. }
  79. message ConfigureTopicRequest {
  80. string namespace = 1;
  81. string topic = 2;
  82. TopicConfiguration configuration = 3;
  83. }
  84. message ConfigureTopicResponse {
  85. }
  86. message GetTopicConfigurationRequest {
  87. string namespace = 1;
  88. string topic = 2;
  89. }
  90. message GetTopicConfigurationResponse {
  91. TopicConfiguration configuration = 1;
  92. }
  93. message TopicConfiguration {
  94. int32 partition_count = 1;
  95. string collection = 2;
  96. string replication = 3;
  97. }