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.

110 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 timestamp = 1 [jstype = JS_STRING]; // When the message was received by the broker
  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 DataMessage {
  58. bytes key = 1; // Message key
  59. bytes value = 2; // Message payload
  60. map<string, bytes> headers = 3; // Message headers
  61. }
  62. DataMessage data = 2;
  63. }
  64. message PublishResponse {
  65. message ConfigMessage {
  66. int32 partition_count = 1;
  67. }
  68. ConfigMessage config = 1;
  69. message RedirectMessage {
  70. string new_broker = 1;
  71. }
  72. RedirectMessage redirect = 2;
  73. }
  74. message ConfigureTopicRequest {
  75. string namespace = 1;
  76. string topic = 2;
  77. TopicConfiguration configuration = 3;
  78. }
  79. message ConfigureTopicResponse {
  80. }
  81. message GetTopicConfigurationRequest {
  82. string namespace = 1;
  83. string topic = 2;
  84. }
  85. message GetTopicConfigurationResponse {
  86. TopicConfiguration configuration = 1;
  87. }
  88. message TopicConfiguration {
  89. int32 partition_count = 1;
  90. string collection = 2;
  91. string replication = 3;
  92. }