Skip to content

Commit

Permalink
update api proto for rust client (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowySpirits committed Apr 2, 2023
1 parent 94fe9bf commit 6e4202a
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 119 deletions.
122 changes: 118 additions & 4 deletions rust/proto/apache/rocketmq/v2/definition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -189,6 +185,7 @@ enum ClientType {
PRODUCER = 1;
PUSH_CONSUMER = 2;
SIMPLE_CONSUMER = 3;
PULL_CONSUMER = 4;
}

enum Encoding {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Loading

0 comments on commit 6e4202a

Please sign in to comment.