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.

128 lines
3.3 KiB

  1. syntax = "proto3";
  2. package messaging_pb;
  3. import "mq_schema.proto";
  4. option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/mq_agent_pb";
  5. option java_package = "seaweedfs.mq_agent";
  6. option java_outer_classname = "MessageQueueAgentProto";
  7. //////////////////////////////////////////////////
  8. service SeaweedMessagingAgent {
  9. // Publishing
  10. rpc StartPublishSession (StartPublishSessionRequest) returns (StartPublishSessionResponse) {
  11. }
  12. rpc ClosePublishSession (ClosePublishSessionRequest) returns (ClosePublishSessionResponse) {
  13. }
  14. rpc PublishRecord (stream PublishRecordRequest) returns (stream PublishRecordResponse) {
  15. }
  16. // Subscribing
  17. rpc StartSubscribeSession (StartSubscribeSessionRequest) returns (StartSubscribeSessionResponse) {
  18. }
  19. rpc CloseSubscribeSession (CloseSubscribeSessionRequest) returns (CloseSubscribeSessionResponse) {
  20. }
  21. rpc SubscribeRecord (stream SubscribeRecordRequest) returns (stream SubscribeRecordResponse) {
  22. }
  23. }
  24. //////////////////////////////////////////////////
  25. message Topic {
  26. string namespace = 1;
  27. string name = 2;
  28. }
  29. message Partition {
  30. int32 ring_size = 1;
  31. int32 range_start = 2;
  32. int32 range_stop = 3;
  33. int64 unix_time_ns = 4;
  34. }
  35. message Offset {
  36. Topic topic = 1;
  37. repeated PartitionOffset partition_offsets = 2;
  38. }
  39. enum PartitionOffsetStartType {
  40. EARLIEST = 0;
  41. EARLIEST_IN_MEMORY = 1;
  42. LATEST = 2;
  43. }
  44. message PartitionOffset {
  45. Partition partition = 1;
  46. int64 start_ts_ns = 2;
  47. int64 stop_ts_ns = 3;
  48. PartitionOffsetStartType start_type = 4;
  49. }
  50. //////////////////////////////////////////////////
  51. message StartPublishSessionRequest {
  52. Topic topic = 1;
  53. int32 partition_count = 2;
  54. schema_pb.RecordType record_type = 3;
  55. string publisher_name = 4;
  56. }
  57. message StartPublishSessionResponse {
  58. string error = 1;
  59. int64 session_id = 2;
  60. }
  61. message ClosePublishSessionRequest {
  62. int64 session_id = 1;
  63. }
  64. message ClosePublishSessionResponse {
  65. string error = 1;
  66. }
  67. //////////////////////////////////////////////////
  68. message PublishRecordRequest {
  69. int64 session_id = 1; // session_id is required for the first record
  70. bytes key = 2;
  71. schema_pb.RecordValue value = 3;
  72. int64 ts_ns = 4;
  73. }
  74. message PublishRecordResponse {
  75. int64 ack_sequence = 1;
  76. string error = 2;
  77. }
  78. //////////////////////////////////////////////////
  79. message StartSubscribeSessionRequest {
  80. string consumer_group = 1;
  81. string consumer_id = 2;
  82. string client_id = 3;
  83. Topic topic = 4;
  84. PartitionOffset partition_offset = 5;
  85. string filter = 6;
  86. int32 concurrency = 8;
  87. }
  88. message StartSubscribeSessionResponse {
  89. string error = 1;
  90. int64 session_id = 2;
  91. }
  92. message CloseSubscribeSessionRequest {
  93. int64 session_id = 1;
  94. }
  95. message CloseSubscribeSessionResponse {
  96. string error = 1;
  97. }
  98. //////////////////////////////////////////////////
  99. message SubscribeRecordRequest {
  100. int64 session_id = 1; // session_id is required for the first record
  101. int64 ack_sequence = 2;
  102. bytes ack_key = 3;
  103. }
  104. message SubscribeRecordResponse {
  105. int64 sequence = 1;
  106. bytes key = 2;
  107. schema_pb.RecordValue value = 3;
  108. int64 ts_ns = 4;
  109. string error = 5;
  110. bool is_end_of_stream = 6;
  111. bool is_end_of_topic = 7;
  112. }
  113. //////////////////////////////////////////////////