messaging.proto 3.3 KB

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