This is an automated email from the ASF dual-hosted git repository.

aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e4202a3 update api proto for rust client (#449)
6e4202a3 is described below

commit 6e4202a3721ae96f4abb14766207ca777b7e29d8
Author: SSpirits <[email protected]>
AuthorDate: Sun Apr 2 12:23:00 2023 +0800

    update api proto for rust client (#449)
---
 rust/proto/apache/rocketmq/v2/definition.proto | 122 +++++++++++++++-
 rust/proto/apache/rocketmq/v2/service.proto    | 186 ++++++++++---------------
 2 files changed, 189 insertions(+), 119 deletions(-)

diff --git a/rust/proto/apache/rocketmq/v2/definition.proto 
b/rust/proto/apache/rocketmq/v2/definition.proto
index 67e58b8f..753bfceb 100644
--- a/rust/proto/apache/rocketmq/v2/definition.proto
+++ b/rust/proto/apache/rocketmq/v2/definition.proto
@@ -175,10 +175,6 @@ enum DigestType {
 // 1) Standard messages should be negatively acknowledged instantly, causing
 // immediate re-delivery; 2) FIFO messages require special RPC, to re-fetch
 // previously acquired messages batch;
-//
-// Message consumption model also affects how invalid digest are handled. When
-// messages are consumed in broadcasting way,
-// TODO: define semantics of invalid-digest-when-broadcasting.
 message Digest {
   DigestType type = 1;
   string checksum = 2;
@@ -189,6 +185,7 @@ enum ClientType {
   PRODUCER = 1;
   PUSH_CONSUMER = 2;
   SIMPLE_CONSUMER = 3;
+  PULL_CONSUMER = 4;
 }
 
 enum Encoding {
@@ -270,9 +267,20 @@ message SystemProperties {
   // orphan. Servers that manages orphan messages would pick up
   // a capable publisher to resolve
   optional google.protobuf.Duration orphaned_transaction_recovery_duration = 
19;
+
+  // Information to identify whether this message is from dead letter queue.
+  optional DeadLetterQueue dead_letter_queue = 20;
+}
+
+message DeadLetterQueue {
+  // Original topic for this DLQ message.
+  string topic = 1;
+  // Original message id for this DLQ message.
+  string message_id = 2;
 }
 
 message Message {
+
   Resource topic = 1;
 
   // User defined key-value pairs.
@@ -336,6 +344,8 @@ enum Code {
   MESSAGE_CORRUPTED = 40016;
   // Request is rejected due to missing of x-mq-client-id header.
   CLIENT_ID_REQUIRED = 40017;
+  // Polling time is illegal.
+  ILLEGAL_POLLING_TIME = 40018;
 
   // Generic code indicates that the client request lacks valid authentication
   // credentials for the requested resource.
@@ -432,6 +442,13 @@ enum Language {
   DOT_NET = 3;
   GOLANG = 4;
   RUST = 5;
+  PYTHON = 6;
+  PHP = 7;
+  NODE_JS = 8;
+  RUBY = 9;
+  OBJECTIVE_C = 10;
+  DART = 11;
+  KOTLIN = 12;
 }
 
 // User Agent
@@ -447,4 +464,101 @@ message UA {
 
   // Hostname of the node
   string hostname = 4;
+}
+
+message Settings {
+  // Configurations for all clients.
+  optional ClientType client_type = 1;
+
+  optional Endpoints access_point = 2;
+
+  // If publishing of messages encounters throttling or server internal errors,
+  // publishers should implement automatic retries after progressive longer
+  // back-offs for consecutive errors.
+  //
+  // When processing message fails, `backoff_policy` describes an interval
+  // after which the message should be available to consume again.
+  //
+  // For FIFO messages, the interval should be relatively small because
+  // messages of the same message group would not be readily available until
+  // the prior one depletes its lifecycle.
+  optional RetryPolicy backoff_policy = 3;
+
+  // Request timeout for RPCs excluding long-polling.
+  optional google.protobuf.Duration request_timeout = 4;
+
+  oneof pub_sub {
+    Publishing publishing = 5;
+
+    Subscription subscription = 6;
+  }
+
+  // User agent details
+  UA user_agent = 7;
+
+  Metric metric = 8;
+}
+
+message Publishing {
+  // Publishing settings below here is appointed by client, thus it is
+  // unnecessary for server to push at present.
+  //
+  // List of topics to which messages will publish to.
+  repeated Resource topics = 1;
+
+  // If the message body size exceeds `max_body_size`, broker servers would
+  // reject the request. As a result, it is advisable that Producer performs
+  // client-side check validation.
+  int32 max_body_size = 2;
+
+  // When `validate_message_type` flag set `false`, no need to validate 
message's type
+  // with messageQueue's `accept_message_types` before publishing.
+  bool validate_message_type = 3;
+}
+
+message Subscription {
+  // Subscription settings below here is appointed by client, thus it is
+  // unnecessary for server to push at present.
+  //
+  // Consumer group.
+  optional Resource group = 1;
+
+  // Subscription for consumer.
+  repeated SubscriptionEntry subscriptions = 2;
+
+  // Subscription settings below here are from server, it is essential for
+  // server to push.
+  //
+  // When FIFO flag is `true`, messages of the same message group are processed
+  // in first-in-first-out manner.
+  //
+  // Brokers will not deliver further messages of the same group until prior
+  // ones are completely acknowledged.
+  optional bool fifo = 3;
+
+  // Message receive batch size here is essential for push consumer.
+  optional int32 receive_batch_size = 4;
+
+  // Long-polling timeout for `ReceiveMessageRequest`, which is essential for
+  // push consumer.
+  optional google.protobuf.Duration long_polling_timeout = 5;
+}
+
+message Metric {
+  // Indicates that if client should export local metrics to server.
+  bool on = 1;
+
+  // The endpoint that client metrics should be exported to, which is required 
if the switch is on.
+  optional Endpoints endpoints = 2;
+}
+
+enum QueryOffsetPolicy {
+  // Use this option if client wishes to playback all existing messages.
+  BEGINNING = 0;
+
+  // Use this option if client wishes to skip all existing messages.
+  END = 1;
+
+  // Use this option if time-based seek is targeted.
+  TIMESTAMP = 2;
 }
\ No newline at end of file
diff --git a/rust/proto/apache/rocketmq/v2/service.proto 
b/rust/proto/apache/rocketmq/v2/service.proto
index 16c0d527..f662f769 100644
--- a/rust/proto/apache/rocketmq/v2/service.proto
+++ b/rust/proto/apache/rocketmq/v2/service.proto
@@ -96,6 +96,7 @@ message ReceiveMessageRequest {
   optional google.protobuf.Duration invisible_duration = 5;
   // For message auto renew and clean
   bool auto_renew = 6;
+  optional google.protobuf.Duration long_polling_timeout = 7;
 }
 
 message ReceiveMessageResponse {
@@ -129,6 +130,7 @@ message AckMessageResultEntry {
 }
 
 message AckMessageResponse {
+
   // RPC tier status, which is used to represent RPC-level errors including
   // authentication, authorization, throttling and other general failures.
   Status status = 1;
@@ -145,18 +147,14 @@ message ForwardMessageToDeadLetterQueueRequest {
   int32 max_delivery_attempts = 6;
 }
 
-message ForwardMessageToDeadLetterQueueResponse {
-  Status status = 1;
-}
+message ForwardMessageToDeadLetterQueueResponse { Status status = 1; }
 
 message HeartbeatRequest {
   optional Resource group = 1;
   ClientType client_type = 2;
 }
 
-message HeartbeatResponse {
-  Status status = 1;
-}
+message HeartbeatResponse { Status status = 1; }
 
 message EndTransactionRequest {
   Resource topic = 1;
@@ -167,13 +165,9 @@ message EndTransactionRequest {
   string trace_context = 6;
 }
 
-message EndTransactionResponse {
-  Status status = 1;
-}
+message EndTransactionResponse { Status status = 1; }
 
-message PrintThreadStackTraceCommand {
-  string nonce = 1;
-}
+message PrintThreadStackTraceCommand { string nonce = 1; }
 
 message ThreadStackTrace {
   string nonce = 1;
@@ -194,92 +188,6 @@ message RecoverOrphanedTransactionCommand {
   string transaction_id = 2;
 }
 
-message Publishing {
-  // Publishing settings below here is appointed by client, thus it is
-  // unnecessary for server to push at present.
-  //
-  // List of topics to which messages will publish to.
-  repeated Resource topics = 1;
-
-  // If the message body size exceeds `max_body_size`, broker servers would
-  // reject the request. As a result, it is advisable that Producer performs
-  // client-side check validation.
-  int32 max_body_size = 2;
-
-  // When `validate_message_type` flag set `false`, no need to validate 
message's type
-  // with messageQueue's `accept_message_types` before publising.
-  bool validate_message_type = 3;
-}
-
-message Subscription {
-  // Subscription settings below here is appointed by client, thus it is
-  // unnecessary for server to push at present.
-  //
-  // Consumer group.
-  optional Resource group = 1;
-
-  // Subscription for consumer.
-  repeated SubscriptionEntry subscriptions = 2;
-
-  // Subscription settings below here are from server, it is essential for
-  // server to push.
-  //
-  // When FIFO flag is `true`, messages of the same message group are processed
-  // in first-in-first-out manner.
-  //
-  // Brokers will not deliver further messages of the same group until prior
-  // ones are completely acknowledged.
-  optional bool fifo = 3;
-
-  // Message receive batch size here is essential for push consumer.
-  optional int32 receive_batch_size = 4;
-
-  // Long-polling timeout for `ReceiveMessageRequest`, which is essential for
-  // push consumer.
-  optional google.protobuf.Duration long_polling_timeout = 5;
-}
-
-message Metric {
-  // Indicates that if client should export local metrics to server.
-  bool on = 1;
-
-  // The endpoint that client metrics should be exported to, which is required 
if the switch is on.
-  optional Endpoints endpoints = 2;
-}
-
-message Settings {
-  // Configurations for all clients.
-  optional ClientType client_type = 1;
-
-  optional Endpoints access_point = 2;
-
-  // If publishing of messages encounters throttling or server internal errors,
-  // publishers should implement automatic retries after progressive longer
-  // back-offs for consecutive errors.
-  //
-  // When processing message fails, `backoff_policy` describes an interval
-  // after which the message should be available to consume again.
-  //
-  // For FIFO messages, the interval should be relatively small because
-  // messages of the same message group would not be readily available until
-  // the prior one depletes its lifecycle.
-  optional RetryPolicy backoff_policy = 3;
-
-  // Request timeout for RPCs excluding long-polling.
-  optional google.protobuf.Duration request_timeout = 4;
-
-  oneof pub_sub {
-    Publishing publishing = 5;
-
-    Subscription subscription = 6;
-  }
-
-  // User agent details
-  UA user_agent = 7;
-
-  Metric metric = 8;
-}
-
 message TelemetryCommand {
   optional Status status = 1;
 
@@ -313,9 +221,7 @@ message NotifyClientTerminationRequest {
   optional Resource group = 1;
 }
 
-message NotifyClientTerminationResponse {
-  Status status = 1;
-}
+message NotifyClientTerminationResponse { Status status = 1; }
 
 message ChangeInvisibleDurationRequest {
   Resource group = 1;
@@ -338,6 +244,54 @@ message ChangeInvisibleDurationResponse {
   string receipt_handle = 2;
 }
 
+message PullMessageRequest {
+  Resource group = 1;
+  MessageQueue message_queue = 2;
+  int64 offset = 3;
+  int32 batch_size = 4;
+  FilterExpression filter_expression = 5;
+  google.protobuf.Duration long_polling_timeout = 6;
+}
+
+message PullMessageResponse {
+  oneof content {
+    Status status = 1;
+    Message message = 2;
+    int64 next_offset = 3;
+  }
+}
+
+message UpdateOffsetRequest {
+  Resource group = 1;
+  MessageQueue message_queue = 2;
+  int64 offset = 3;
+}
+
+message UpdateOffsetResponse {
+  Status status = 1;
+}
+
+message GetOffsetRequest {
+  Resource group = 1;
+  MessageQueue message_queue = 2;
+}
+
+message GetOffsetResponse {
+  Status status = 1;
+  int64 offset = 2;
+}
+
+message QueryOffsetRequest {
+  MessageQueue message_queue = 1;
+  QueryOffsetPolicy query_offset_policy = 2;
+  optional google.protobuf.Timestamp timestamp = 3;
+}
+
+message QueryOffsetResponse {
+  Status status = 1;
+  int64 offset = 2;
+}
+
 // For all the RPCs in MessagingService, the following error handling policies
 // apply:
 //
@@ -349,6 +303,7 @@ message ChangeInvisibleDurationResponse {
 // common.status.code == `RESOURCE_EXHAUSTED`. If any unexpected server-side
 // errors raise, return a response with common.status.code == `INTERNAL`.
 service MessagingService {
+
   // Queries the route entries of the requested topic in the perspective of the
   // given endpoints. On success, servers should return a collection of
   // addressable message-queues. Note servers may return customized route
@@ -356,8 +311,7 @@ service MessagingService {
   //
   // If the requested topic doesn't exist, returns `NOT_FOUND`.
   // If the specific endpoints is empty, returns `INVALID_ARGUMENT`.
-  rpc QueryRoute(QueryRouteRequest) returns (QueryRouteResponse) {
-  }
+  rpc QueryRoute(QueryRouteRequest) returns (QueryRouteResponse) {}
 
   // Producer or consumer sends HeartbeatRequest to servers periodically to
   // keep-alive. Additionally, it also reports client-side configuration,
@@ -367,8 +321,7 @@ service MessagingService {
   //
   // If a client specifies a language that is not yet supported by servers,
   // returns `INVALID_ARGUMENT`
-  rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse) {
-  }
+  rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse) {}
 
   // Delivers messages to brokers.
   // Clients may further:
@@ -383,8 +336,7 @@ service MessagingService {
   // Returns message-id or transaction-id with status `OK` on success.
   //
   // If the destination topic doesn't exist, returns `NOT_FOUND`.
-  rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) {
-  }
+  rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) {}
 
   // Queries the assigned route info of a topic for current consumer,
   // the returned assignment result is decided by server-side load balancer.
@@ -418,18 +370,23 @@ service MessagingService {
   //
   // If the given receipt_handle is illegal or out of date, returns
   // `INVALID_ARGUMENT`.
-  rpc AckMessage(AckMessageRequest) returns (AckMessageResponse) {
-  }
+  rpc AckMessage(AckMessageRequest) returns (AckMessageResponse) {}
 
   // Forwards one message to dead letter queue if the max delivery attempts is
   // exceeded by this message at client-side, return `OK` if success.
   rpc ForwardMessageToDeadLetterQueue(ForwardMessageToDeadLetterQueueRequest)
-      returns (ForwardMessageToDeadLetterQueueResponse) {
-  }
+      returns (ForwardMessageToDeadLetterQueueResponse) {}
+
+  rpc PullMessage(PullMessageRequest) returns (stream PullMessageResponse) {}
+
+  rpc UpdateOffset(UpdateOffsetRequest) returns (UpdateOffsetResponse) {}
+
+  rpc GetOffset(GetOffsetRequest) returns (GetOffsetResponse) {}
+
+  rpc QueryOffset(QueryOffsetRequest) returns (QueryOffsetResponse) {}
 
   // Commits or rollback one transactional message.
-  rpc EndTransaction(EndTransactionRequest) returns (EndTransactionResponse) {
-  }
+  rpc EndTransaction(EndTransactionRequest) returns (EndTransactionResponse) {}
 
   // Once a client starts, it would immediately establishes bi-lateral stream
   // RPCs with brokers, reporting its settings as the initiative command.
@@ -437,8 +394,7 @@ service MessagingService {
   // When servers have need of inspecting client status, they would issue
   // telemetry commands to clients. After executing received instructions,
   // clients shall report command execution results through client-side 
streams.
-  rpc Telemetry(stream TelemetryCommand) returns (stream TelemetryCommand) {
-  }
+  rpc Telemetry(stream TelemetryCommand) returns (stream TelemetryCommand) {}
 
   // Notify the server that the client is terminated.
   rpc NotifyClientTermination(NotifyClientTerminationRequest) returns 
(NotifyClientTerminationResponse) {

Reply via email to