You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2022/03/28 09:46:44 UTC

[rocketmq-apis] branch v2 updated: Refactor the response common (#15)

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

lizhanhui pushed a commit to branch v2
in repository https://gitbox.apache.org/repos/asf/rocketmq-apis.git


The following commit(s) were added to refs/heads/v2 by this push:
     new 7210096  Refactor the response common (#15)
7210096 is described below

commit 721009644c31b186c4b80474e0469cde82f3ff54
Author: Aaron Ai <ya...@alibaba-inc.com>
AuthorDate: Mon Mar 28 17:46:39 2022 +0800

    Refactor the response common (#15)
    
    * Refactor the response common
    
    * Update CI config
    
    * Fix typo
---
 .github/workflows/main.yml          |   2 +-
 apache/rocketmq/v2/definition.proto |   8 +--
 apache/rocketmq/v2/service.proto    | 109 +++++++++++++++++++++++-------------
 3 files changed, 74 insertions(+), 45 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3116429..feb9f2d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -8,7 +8,7 @@ on:
   push:
     branches: [ main ]
   pull_request:
-    branches: [ main ]
+    branches: [ main, v2 ]
 
   # Allows you to run this workflow manually from the Actions tab
   workflow_dispatch:
diff --git a/apache/rocketmq/v2/definition.proto b/apache/rocketmq/v2/definition.proto
index 2dff762..d04f761 100644
--- a/apache/rocketmq/v2/definition.proto
+++ b/apache/rocketmq/v2/definition.proto
@@ -285,7 +285,7 @@ enum Encoding {
   GZIP = 2;
 }
 
-message SystemAttribute {
+message SystemProperties {
   // Tag
   string tag = 1;
 
@@ -355,13 +355,13 @@ message Message {
   Resource topic = 1;
 
   // User defined key-value pairs.
-  // If user_attribute contains the reserved keys by RocketMQ,
+  // If user_properties contain the reserved keys by RocketMQ,
   // the send message request will be aborted with status `INVALID_ARGUMENT`.
   // See below links for the reserved keys
   // https://github.com/apache/rocketmq/blob/master/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java#L58
-  map<string, string> user_attribute = 2;
+  map<string, string> user_properties = 2;
 
-  SystemAttribute system_attribute = 3;
+  SystemProperties system_properties = 3;
 
   bytes body = 4;
 }
diff --git a/apache/rocketmq/v2/service.proto b/apache/rocketmq/v2/service.proto
index 4dfecbe..6cd2a94 100644
--- a/apache/rocketmq/v2/service.proto
+++ b/apache/rocketmq/v2/service.proto
@@ -31,13 +31,54 @@ option java_generate_equals_and_hash = true;
 option java_string_check_utf8 = true;
 option java_outer_classname = "MQService";
 
-message ResponseCommon {
-  google.rpc.Status status = 1;
-  google.rpc.RequestInfo request_info = 2;
-  google.rpc.Help help = 3;
-  google.rpc.RetryInfo retry_info = 4;
-  google.rpc.DebugInfo debug_info = 5;
-  google.rpc.ErrorInfo error_info = 6;
+enum ResponseCode {
+  // Success.
+  OK = 0;
+  // Format of access point is illegal.
+  ILLEGAL_ACCESS_POINT = 1;
+  // Format of topic is illegal.
+  ILLEGAL_TOPIC = 2;
+  // Format of consumer group is illegal.
+  ILLEGAL_CONSUMER_GROUP = 3;
+  // Format of message tag is illegal.
+  ILLEGAL_MESSAGE_TAG = 4;
+  // Format of message key is illegal.
+  ILLEGAL_MESSAGE_KEY = 5;
+  // Size of message keys exceeds the threshold.
+  MESSAGE_KEYS_TOO_LARGE = 6;
+  // Format of message group is illegal.
+  ILLEGAL_MESSAGE_GROUP = 7;
+  // Format of message property key is illegal.
+  ILLEGAL_MESSAGE_PROPERTY_KEY = 8;
+  // Message properties total size exceeds the threshold.
+  MESSAGE_PROPERTIES_TOO_LARGE = 9;
+  // Message body size exceeds the threshold.
+  MESSAGE_BODY_TOO_LARGE = 10;
+  // User does have the permission to operate.
+  REQUEST_AUTHORISATION_FAILURE = 11;
+  // User's identity could not be recognized.
+  REQUEST_AUTHENTICATION_FAILURE = 12;
+  // Topic resource does not exist.
+  TOPIC_DOES_NOT_EXIST = 13;
+  // Consumer group resource does not exist.
+  CONSUMER_GROUP_DOES_NOT_EXIST = 14;
+  // Not allowed to verify message.
+  VERIFY_MESSAGE_NOT_ALLOWED = 15;
+  // Failed to consume message.
+  FAILED_TO_CONSUME_MESSAGE = 16;
+  // Message is corrupted.
+  MESSAGE_CORRUPTED = 17;
+  // Flow control.
+  REQUEST_FLOW_CONTROL = 18;
+  // Ack request is expired.
+  ACKNOWLEDGEMENT_EXPIRED = 19;
+  // Message property is not match the message type.
+  MESSAGE_PROPERTY_DOES_NOT_MATCH_MESSAGE_TYPE = 20;
+}
+
+message Status {
+  ResponseCode code = 1;
+  string message = 2;
 }
 
 // Topics are destination of messages to publish to or subscribe from. Similar
@@ -64,7 +105,7 @@ message QueryRouteRequest {
 }
 
 message QueryRouteResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
 
   repeated MessageQueue message_queues = 2;
 }
@@ -75,7 +116,7 @@ message SendMessageRequest {
 }
 
 message SendMessageResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
   repeated SendReceipt receipts = 2;
 }
 
@@ -89,7 +130,7 @@ message QueryAssignmentRequest {
 }
 
 message QueryAssignmentResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
   repeated Assignment assignments = 2;
 }
 
@@ -106,7 +147,7 @@ message ReceiveMessageRequest {
 }
 
 message ReceiveMessageResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
   repeated Message messages = 2;
   google.protobuf.Timestamp delivery_timestamp = 3;
   google.protobuf.Duration invisible_duration = 4;
@@ -120,9 +161,7 @@ message AckMessageRequest {
   string message_id = 5;
 }
 
-message AckMessageResponse {
-  ResponseCommon common = 1;
-}
+message AckMessageResponse { Status status = 1; }
 
 message ForwardMessageToDeadLetterQueueRequest {
   Resource group = 1;
@@ -134,18 +173,14 @@ message ForwardMessageToDeadLetterQueueRequest {
   int32 max_delivery_attempts = 7;
 }
 
-message ForwardMessageToDeadLetterQueueResponse {
-  ResponseCommon common = 1;
-}
+message ForwardMessageToDeadLetterQueueResponse { Status status = 1; }
 
 message HeartbeatRequest {
   string client_id = 1;
   Resource group = 2;
 }
 
-message HeartbeatResponse {
-  ResponseCommon common = 1;
-}
+message HeartbeatResponse { Status status = 1; }
 
 message EndTransactionRequest {
   Resource group = 1;
@@ -156,9 +191,7 @@ message EndTransactionRequest {
   string trace_context = 6;
 }
 
-message EndTransactionResponse {
-  ResponseCommon common = 1;
-}
+message EndTransactionResponse { Status status = 1; }
 
 message QueryOffsetRequest {
   MessageQueue message_queue = 1;
@@ -167,7 +200,7 @@ message QueryOffsetRequest {
 }
 
 message QueryOffsetResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
   int64 offset = 2;
 }
 
@@ -182,16 +215,14 @@ message PullMessageRequest {
 }
 
 message PullMessageResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
   int64 min_offset = 2;
   int64 next_offset = 3;
   int64 max_offset = 4;
   repeated Message messages = 5;
 }
 
-message PrintThreadStackTraceCommand {
-  int64 command_id = 1;
-}
+message PrintThreadStackTraceCommand { int64 command_id = 1; }
 
 message ThreadStackTrace {
   int64 command_id = 1;
@@ -205,7 +236,7 @@ message VerifyMessageCommand {
 
 message VerifyMessageResult {
   int64 command_id = 1;
-  ResponseCommon common = 2;
+  Status status = 2;
 }
 
 message RecoverOrphanedTransactionCommand {
@@ -233,7 +264,7 @@ message TelemetryCommand {
     PrintThreadStackTraceCommand print_thread_stack_trace_command = 3;
 
     ThreadStackTrace thread_stack_trace = 4;
-    
+
     // Request client to verify the consumption of the appointed message.
     VerifyMessageCommand verify_message_command = 5;
 
@@ -246,9 +277,7 @@ message NotifyClientTerminationRequest {
   string client_id = 2;
 }
 
-message NotifyClientTerminationResponse {
-  ResponseCommon common = 1;
-}
+message NotifyClientTerminationResponse { Status status = 1; }
 
 message ChangeInvisibleDurationRequest {
   Resource group = 1;
@@ -262,7 +291,7 @@ message ChangeInvisibleDurationRequest {
 }
 
 message ChangeInvisibleDurationResponse {
-  ResponseCommon common = 1;
+  Status status = 1;
 
   // Server may generate a new receipt handle for the message.
   string receipt_handle = 2;
@@ -369,12 +398,12 @@ service MessagingService {
   // Please note that client may suffer from false empty responses.
   rpc PullMessage(PullMessageRequest) returns (PullMessageResponse) {}
 
-  // Once a client starts, it would immediately establishes bi-lateral stream RPCs
-  // with brokers, reporting its settings as the initiative command.
-  // 
-  // When servers have need of inspecting client status, they would issue telemetry
-  // commands to clients. After executing recieved instructions, clients shall
-  // report command execution results through client-side streams.
+  // Once a client starts, it would immediately establishes bi-lateral stream
+  // RPCs with brokers, reporting its settings as the initiative command.
+  //
+  // When servers have need of inspecting client status, they would issue
+  // telemetry commands to clients. After executing recieved instructions,
+  // clients shall report command execution results through client-side streams.
   rpc Telemetry(stream TelemetryCommand) returns (stream TelemetryCommand) {}
 
   // Notify the server that the client is terminated.