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
commit be2db293d795c2e452243632ef9c605ae6c89bc1 Author: Aaron Ai <[email protected]> AuthorDate: Mon Jun 20 13:51:19 2022 +0800 Java: fix a series of typos --- README.md | 6 +- .../rocketmq/client/apis/ClientConfiguration.java | 2 +- .../rocketmq/client/apis/ClientException.java | 4 +- .../client/apis/ClientServiceProvider.java | 4 +- .../client/apis/consumer/FilterExpression.java | 2 +- .../client/apis/consumer/MessageListener.java | 9 ++- .../client/apis/consumer/PushConsumer.java | 24 +++---- .../client/apis/consumer/PushConsumerBuilder.java | 4 +- .../client/apis/consumer/SimpleConsumer.java | 82 ++++++++++------------ .../apis/consumer/SimpleConsumerBuilder.java | 14 ++-- .../client/apis/message/MessageBuilder.java | 34 ++++----- .../rocketmq/client/apis/message/MessageId.java | 6 +- .../rocketmq/client/apis/message/MessageView.java | 34 ++++----- .../rocketmq/client/apis/producer/Producer.java | 22 +++--- .../client/apis/producer/ProducerBuilder.java | 6 +- .../rocketmq/client/apis/producer/SendReceipt.java | 2 +- .../rocketmq/client/apis/producer/Transaction.java | 8 +-- .../apis/producer/TransactionResolution.java | 4 +- .../client/java/message/MessageIdCodec.java | 8 +-- 19 files changed, 134 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index 2591238..5454e7a 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,17 @@ ## Overview -Polyglot solution of clients for [Apache RocketMQ](https://rocketmq.apache.org/), and both of them follow the specification of [rocketmq-apis](https://github.com/apache/rocketmq-apis), replace the previous protocol based on `RemotingCommand` by [Protocol Buffers](https://developers.google.com/protocol-buffers) and [gRPC](https://grpc.io/). Apart from that, APIs from clients of different languages share the same model and semantics. +Polyglot solutions of clients for [Apache RocketMQ](https://rocketmq.apache.org/), and both of them follow the specification of [rocketmq-apis](https://github.com/apache/rocketmq-apis), replace the previous protocol based on `RemotingCommand` by [Protocol Buffers](https://developers.google.com/protocol-buffers) and [gRPC](https://grpc.io/). Apart from that, APIs from clients of different languages share the same model and semantics. ## Goal -Provides cloud-native and robust solution for mainstream programming languages. +Provides cloud-native and robust solutions for mainstream programming languages. ## Related * [rocketmq](https://github.com/apache/rocketmq): The implementation of server-side. * [rocketmq-apis](https://github.com/apache/rocketmq-apis): Common communication protocol between server and client. -* [RIP-37: New and Unified APIs](https://shimo.im/docs/m5kv92OeRRU8olqX): RocketMQ proposal of new and unified APIs acrossing different languages. +* [RIP-37: New and Unified APIs](https://shimo.im/docs/m5kv92OeRRU8olqX): RocketMQ proposal of new and unified APIs crossing different languages. * [RIP-39: Support gRPC protocol](https://shimo.im/docs/gXqmeEPYgdUw5bqo): RocketMQ proposal of gRPC protocol support. ## License diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfiguration.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfiguration.java index 620b71c..8ee8dee 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfiguration.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientConfiguration.java @@ -29,7 +29,7 @@ public class ClientConfiguration { private final Duration requestTimeout; /** - * The caller is supposed to have validated the arguments and handled throwing exception or + * The caller is supposed to have validated the arguments and handled throwing exceptions or * logging warnings already, so we avoid repeating args check here. */ ClientConfiguration(String endpoints, SessionCredentialsProvider sessionCredentialsProvider, diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientException.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientException.java index 54387ec..9a0ced1 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientException.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientException.java @@ -27,12 +27,12 @@ import java.util.Optional; import java.util.stream.Collectors; /** - * Base exception for all exception raised in client, each exception should derive from current class. + * Base exception for all exceptions raised in client, each exception should derive from the current class. * It should throw exception which is derived from {@link ClientException} rather than {@link ClientException} itself. */ public class ClientException extends Exception { /** - * For those {@link ClientException} along with a remote procedure call, request id could be used to track the + * For those {@link ClientException} along with a remote procedure call, request-id could be used to track the * request. */ protected static final String REQUEST_ID_KEY = "request-id"; diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientServiceProvider.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientServiceProvider.java index e92486a..ed9dc32 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientServiceProvider.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/ClientServiceProvider.java @@ -39,14 +39,14 @@ public interface ClientServiceProvider { } /** - * Get the producer builder by current provider. + * Get the producer builder by the current provider. * * @return the producer builder instance. */ ProducerBuilder newProducerBuilder(); /** - * Get the message builder by current provider. + * Get the message builder by the current provider. * * @return the message builder instance. */ diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/FilterExpression.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/FilterExpression.java index 411c5e4..3325fed 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/FilterExpression.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/FilterExpression.java @@ -23,7 +23,7 @@ import com.google.common.base.Objects; /** * Filter expression is an efficient way to filter message for {@link SimpleConsumer} and {@link PushConsumer}. - * Consumer who applied the filter expression only can receive the filtered messages. + * The consumer who applied the filter expression only can receive the filtered messages. */ public class FilterExpression { private static final String TAG_EXPRESSION_SUB_ALL = "*"; diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/MessageListener.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/MessageListener.java index 66e4d43..fc66a4f 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/MessageListener.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/MessageListener.java @@ -20,15 +20,14 @@ package org.apache.rocketmq.client.apis.consumer; import org.apache.rocketmq.client.apis.message.MessageView; /** - * MessageListener is used only for push consumer to process message consumption synchronously. + * MessageListener is used only for the push consumer to process message consumption synchronously. * - * <p> Refer to {@link PushConsumer}, push consumer will get message from server - * and dispatch the message to backend thread pool which control by parameter threadCount to consumer message - * concurrently. + * <p> Refer to {@link PushConsumer}, push consumer will get message from server and dispatch the message to the + * backend thread pool to consumer message concurrently. */ public interface MessageListener { /** - * The callback interface to consume message. + * The callback interface to consume the message. * * <p>You should process the {@link MessageView} and return the corresponding {@link ConsumeResult}. * The consumption is successful only when {@link ConsumeResult#SUCCESS } is returned, null pointer is returned diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumer.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumer.java index 51c07ea..c0ecf17 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumer.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumer.java @@ -23,12 +23,12 @@ import java.util.Map; import org.apache.rocketmq.client.apis.ClientException; /** - * Push consumer is a thread-safe and full-managed rocketmq client which is used to consume message by group. + * Push consumer is a thread-safe and fully-managed rocketmq client which is used to consume messages by the group. * - * <p>Consumers belong to the same consumer group share messages from server, which means they must have the same + * <p>Consumers belong to the same consumer group share messages from the server, which means they must have the same * subscription expressions, otherwise the behavior is <strong>undefined</strong>. If a new consumer group's consumer - * is started first time, it consumes from the latest position. Once consumer is started, server records its - * consumption progress and derives it in subsequent startup, or we can call it clustering mode. + * is started for the first time, it consumes from the latest position. Once the consumer is started, the server + * records its consumption progress and derives it in the subsequent startup, or we can call it clustering mode. * * <h3>Clustering mode</h3> * <pre> @@ -41,8 +41,8 @@ import org.apache.rocketmq.client.apis.ClientException; * └─────────────────┘ └──────────┘ * </pre> * - * <p>As for broadcasting mode, you may intend to maintain different consumption progress for different consumer, - * different consumer group should be set in this case. + * <p>As for broadcasting mode, you may intend to maintain different consumption progress for different consumers, + * different consumer groups should be set in this case. * * <h3>Broadcasting mode</h3> * <pre> @@ -64,7 +64,7 @@ import org.apache.rocketmq.client.apis.ClientException; */ public interface PushConsumer extends Closeable { /** - * Get the load balancing group for consumer. + * Get the load balancing group for the consumer. * * @return consumer load balancing group. */ @@ -73,7 +73,7 @@ public interface PushConsumer extends Closeable { /** * List the existed subscription expressions in push consumer. * - * @return collections of subscription expression. + * @return collections of the subscription expression. */ Map<String, FilterExpression> getSubscriptionExpressions(); @@ -88,12 +88,12 @@ public interface PushConsumer extends Closeable { /** * Remove subscription expression dynamically by topic. * - * <p>It stops the backend task to fetch message from remote, and besides that, the local cached message whose topic - * was removed before would not be delivered to {@link MessageListener} anymore. + * <p>It stops the backend task to fetch messages from the server, and besides that, the locally cached message + * whose topic was removed before would not be delivered to {@link MessageListener} anymore. * - * <p>Nothing occurs if the specified topic does not exist in subscription expressions of push consumer. + * <p>Nothing occurs if the specified topic does not exist in subscription expressions of the push consumer. * - * @param topic the topic to remove subscription. + * @param topic the topic to remove the subscription. * @return push consumer instance. */ PushConsumer unsubscribe(String topic) throws ClientException; diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumerBuilder.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumerBuilder.java index dcd774f..d628c60 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumerBuilder.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/PushConsumerBuilder.java @@ -26,7 +26,7 @@ import org.apache.rocketmq.client.apis.ClientException; */ public interface PushConsumerBuilder { /** - * Set the client configuration for consumer. + * Set the client configuration for the consumer. * * @param clientConfiguration client's configuration. * @return the consumer builder instance. @@ -34,7 +34,7 @@ public interface PushConsumerBuilder { PushConsumerBuilder setClientConfiguration(ClientConfiguration clientConfiguration); /** - * Set the load balancing group for consumer. + * Set the load balancing group for the consumer. * * @param consumerGroup consumer load balancing group. * @return the consumer builder instance. diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumer.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumer.java index c931418..085139c 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumer.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumer.java @@ -27,12 +27,12 @@ import org.apache.rocketmq.client.apis.ClientException; import org.apache.rocketmq.client.apis.message.MessageView; /** - * Simple consumer is a thread-safe rocketmq client which is used to consume message by group. + * Simple consumer is a thread-safe rocketmq client which is used to consume messages by the consumer group. * - * <p>Simple consumer is lightweight consumer, if you want fully control the message consumption operation by yourself, - * simple consumer should be your first consideration. + * <p>Simple consumer is a lightweight consumer, if you want to fully control the message consumption operation by + * yourself, the simple consumer should be your first consideration. * - * <p>Similar to {@link PushConsumer}, consumers belong to the same consumer group share messages from server, which + * <p>Similar to {@link PushConsumer}, consumers belong to the same consumer group share messages from the server, which * means they must have the same subscription expressions, otherwise the behavior is <strong>UNDEFINED</strong>. * * <p>In addition, the simple consumer can share a consumer group with the {@link PushConsumer}, at which time they @@ -50,13 +50,14 @@ import org.apache.rocketmq.client.apis.message.MessageView; * </pre> * * <p>Simple consumer divide message consumption to 3 phases. - * 1. Receive message from server. - * 2. Executes your operations after receiving message. - * 3. Acknowledge the message or change its invisible duration before next delivery according the operation result. + * 1. Receive messages from the server. + * 2. Executes your operations after receiving messages. + * 3. Acknowledge the message or change its invisible duration before the next delivery according to the operation + * result. */ public interface SimpleConsumer extends Closeable { /** - * Get the load balancing group for simple consumer. + * Get the load balancing group for the simple consumer. * * @return consumer load balancing group. */ @@ -65,11 +66,11 @@ public interface SimpleConsumer extends Closeable { /** * Add subscription expression dynamically. * - * <p>If first subscriptionExpression that contains topicA and tag1 is exists already in consumer, then - * second subscriptionExpression which contains topicA and tag2, <strong>the result is that the second one + * <p>If the first subscription expression that contains topicA and tag1 has existed already in the consumer, then + * second subscription expression which contains topicA and tag2, <strong>the result is that the second one * replaces the first one instead of integrating them</strong>. * - * @param topic new topic that need to add or update. + * @param topic new topic that needs to add or update. * @param filterExpression new filter expression to add or update. * @return simple consumer instance. */ @@ -78,12 +79,13 @@ public interface SimpleConsumer extends Closeable { /** * Remove subscription expression dynamically by topic. * - * <p>It stops the backend task to fetch message from remote, and besides that, the local cached message whose topic + * <p>It stops the backend task to fetch messages from remote, and besides that, the locally cached message whose + * topic * was removed before would not be delivered to {@link MessageListener} anymore. * - * <p>Nothing occurs if the specified topic does not exist in subscription expressions of push consumer. + * <p>Nothing occurs if the specified topic does not exist in subscription expressions of the push consumer. * - * @param topic the topic to remove subscription. + * @param topic the topic to remove the subscription. * @return simple consumer instance. */ SimpleConsumer unsubscribe(String topic) throws ClientException; @@ -91,49 +93,49 @@ public interface SimpleConsumer extends Closeable { /** * List the existed subscription expressions in simple consumer. * - * @return map of topic to filter expression. + * @return map of topics to filter expression. */ Map<String, FilterExpression> getSubscriptionExpressions(); /** - * Fetch messages from server synchronously. + * Fetch messages from the server synchronously. * <p> This method returns immediately if there are messages available. * Otherwise, it will await the passed timeout. If the timeout expires, an empty map will be returned. * - * @param maxMessageNum max message num when server returns. - * @param invisibleDuration set the invisibleDuration of messages return from server. These messages will be - * invisible to other consumer unless timout. - * @return list of messageView + * @param maxMessageNum max message num of server returned. + * @param invisibleDuration set the invisibleDuration of messages to return from the server. These messages will be + * invisible to other consumers unless timeout. + * @return list of message view. */ List<MessageView> receive(int maxMessageNum, Duration invisibleDuration) throws ClientException; /** - * Fetch messages from server asynchronously. + * Fetch messages from the server asynchronously. * <p> This method returns immediately if there are messages available. * Otherwise, it will await the passed timeout. If the timeout expires, an empty map will be returned. * - * @param maxMessageNum max message num when server returns. - * @param invisibleDuration set the invisibleDuration of messages return from server. These messages will be - * invisible to other consumer unless timout. - * @return list of messageView + * @param maxMessageNum max message num of server returned. + * @param invisibleDuration set the invisibleDuration of messages to return from the server. These messages will be + * invisible to other consumers unless timeout. + * @return list of message view. */ CompletableFuture<List<MessageView>> receiveAsync(int maxMessageNum, Duration invisibleDuration); /** * Ack message to server synchronously, server commit this message. * - * <p> Duplicate ack request does not take effect and throw exception. + * <p>Duplicate ack request does not take effect and throw an exception. * - * @param messageView special messageView with handle want to ack. + * @param messageView special message view with handle want to ack. */ void ack(MessageView messageView) throws ClientException; /** - * Ack message to server asynchronously, server commit this message. + * Ack message to the server asynchronously, server commit this message. * - * <p> Duplicate ack request does not take effect and throw exception. + * <p> Duplicate ack request does not take effect and throw an exception. * - * @param messageView special messageView with handle want to ack. + * @param messageView special message view with handle want to ack. * @return CompletableFuture of this request. */ CompletableFuture<Void> ackAsync(MessageView messageView); @@ -143,14 +145,10 @@ public interface SimpleConsumer extends Closeable { * * <p> The origin invisible duration for a message decide by ack request. * - * <p>You must call change request before the origin invisible duration timeout. - * If called change request later than the origin invisible duration, this request does not take effect and throw - * exception. + * <p>Duplicate change requests will refresh the next visible time of this message to consumers. * - * <p>Duplicate change request will refresh the next visible time of this message to other consumers. - * - * @param messageView special messageView with handle want to change. - * @param invisibleDuration new timestamp the message could be visible and reconsume which start from current time. + * @param messageView the message view to change invisible time. + * @param invisibleDuration new timestamp the message could be visible and re-consume which start from current time. */ void changeInvisibleDuration(MessageView messageView, Duration invisibleDuration) throws ClientException; @@ -159,14 +157,10 @@ public interface SimpleConsumer extends Closeable { * * <p> The origin invisible duration for a message decide by ack request. * - * <p> You must call change request before the origin invisible duration timeout. - * If called change request later than the origin invisible duration, this request does not take effect and throw - * exception. - * - * <p>Duplicate change request will refresh the next visible time of this message to other consumers. + * <p>Duplicate change requests will refresh the next visible time of this message to consumers. * - * @param messageView special messageView with handle want to change. - * @param invisibleDuration new timestamp the message could be visible and reconsume which start from current time. + * @param messageView the message view to change invisible time. + * @param invisibleDuration new timestamp the message could be visible and re-consume which start from current time. * @return CompletableFuture of this request. */ CompletableFuture<Void> changeInvisibleDurationAsync(MessageView messageView, Duration invisibleDuration); diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumerBuilder.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumerBuilder.java index 9f86013..774d4d4 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumerBuilder.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/consumer/SimpleConsumerBuilder.java @@ -27,7 +27,7 @@ import org.apache.rocketmq.client.apis.ClientException; */ public interface SimpleConsumerBuilder { /** - * Set the client configuration for simple consumer. + * Set the client configuration for the simple consumer. * * @param clientConfiguration client's configuration. * @return the simple consumer builder instance. @@ -35,7 +35,7 @@ public interface SimpleConsumerBuilder { SimpleConsumerBuilder setClientConfiguration(ClientConfiguration clientConfiguration); /** - * Set the load balancing group for simple consumer. + * Set the load balancing group for the simple consumer. * * @param consumerGroup consumer load balancing group. * @return the consumer builder instance. @@ -43,19 +43,19 @@ public interface SimpleConsumerBuilder { SimpleConsumerBuilder setConsumerGroup(String consumerGroup); /** - * Add subscriptionExpressions for simple consumer. + * Add subscription expressions for the simple consumer. * - * @param subscriptionExpressions subscriptions to add which use the map of topic to filterExpression. + * @param subscriptionExpressions subscriptions to add which use the map of topics to filter expressions. * @return the consumer builder instance. */ SimpleConsumerBuilder setSubscriptionExpressions(Map<String, FilterExpression> subscriptionExpressions); /** - * Set the max await time when receive message from server. + * Set the max await time when receive messages from the server. * The simple consumer will hold this long-polling receive requests until a message is returned or a timeout * occurs. * - * @param awaitDuration The maximum time to block when no message available. + * @param awaitDuration The maximum time to block when no message is available. * @return the consumer builder instance. */ SimpleConsumerBuilder setAwaitDuration(Duration awaitDuration); @@ -63,7 +63,7 @@ public interface SimpleConsumerBuilder { /** * Finalize the build of the {@link SimpleConsumer} instance and start. * - * <p>This method will block until simple consumer starts successfully. + * <p>This method will block until the simple consumer starts successfully. * * @return the simple consumer instance. */ diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageBuilder.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageBuilder.java index f5f4a98..62fc9c7 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageBuilder.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageBuilder.java @@ -22,42 +22,42 @@ package org.apache.rocketmq.client.apis.message; */ public interface MessageBuilder { /** - * Set the topic for message, which is essential for each message. + * Set the topic for the message, which is essential for each message. * - * @param topic topic for the message. + * @param topic the topic for the message. * @return the message builder instance. */ MessageBuilder setTopic(String topic); /** - * Set the body for message, which is essential for each message. + * Set the body for the message, which is essential for each message. * - * <p>{@link Message} will deep-copy the body as its payload, thus any modification about the original body would - * not affect message itself. + * <p>{@link Message} will deep-copy the body as its payload, thus any modification to the original body would + * not affect the message itself. * - * @param body body for the message. + * @param body the body for the message. * @return the message builder instance. */ MessageBuilder setBody(byte[] body); /** - * Set the tag for message, which is optional. + * Set the tag for the message, which is optional. * - * <p>Tag is a secondary classifier for each message besides topic. + * <p>Tag is a secondary classifier for each message besides the topic. * - * @param tag tag for the message. + * @param tag the tag for the message. * @return the message builder instance. */ MessageBuilder setTag(String tag); /** - * Set the key collection for message, which is optional. + * Set the key collection for the message, which is optional. * * <p>Message key is another way to locate a message besides the {@link MessageId}, so it should be unique for * each message usually. * - * <p>Set a single key for each message is enough in most case, but the variadic argument here allows you to set - * multiple key at the same time. For example: + * <p>Set a single key for each message is enough in most cases, but the variadic argument here allows you to set + * multiple keys at the same time. For example: * * <pre>{@code * // Example 0: single key. @@ -78,9 +78,9 @@ public interface MessageBuilder { MessageBuilder setKeys(String... keys); /** - * Set the group for message, which is optional. + * Set the group for the message, which is optional. * - * <p>Message group and delivery timestamp should not be set in the same message. + * <p>Message group and the delivery timestamp should not be set in the same message. * * @param messageGroup group for the message. * @return the message builder instance. @@ -96,17 +96,17 @@ public interface MessageBuilder { MessageBuilder setTraceContext(String traceContext); /** - * Set the delivery timestamp for message, which is optional. + * Set the delivery timestamp for the message, which is optional. * * <p>Delivery timestamp and message group should not be set in the same message. * - * @param deliveryTimestamp delivery timestamp for message. + * @param deliveryTimestamp delivery timestamp for the message. * @return the message builder instance. */ MessageBuilder setDeliveryTimestamp(long deliveryTimestamp); /** - * Add user property for message. + * Add user property for the message. * * @param key single property key. * @param value single property value. diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageId.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageId.java index 226f43d..fd0ab78 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageId.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageId.java @@ -23,14 +23,14 @@ package org.apache.rocketmq.client.apis.message; */ public interface MessageId { /** - * Get the version of message id. + * Get the version of the message-id. * - * @return the version of message id. + * @return the version of message-id. */ String getVersion(); /** - * The implementation <strong>must</strong> override this method, which indicates the message id using string form. + * The implementation <strong>must</strong> override this method, which indicates the message-id using string form. * * @return string-formed string id. */ diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageView.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageView.java index bf74ebf..04d576b 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageView.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/message/MessageView.java @@ -23,26 +23,26 @@ import java.util.Map; import java.util.Optional; /** - * {@link MessageView} provides a read-only view for message, that's why setters do not exist here. In addition, + * {@link MessageView} provides a read-only view for the message, that's why setters do not exist here. In addition, * it only makes sense when {@link Message} is sent successfully. */ public interface MessageView { /** - * Get the unique id of message. + * Get the unique id of the message. * * @return unique id. */ MessageId getMessageId(); /** - * Get the topic of message, which is the first classifier for message. + * Get the topic of the message, which is the first classifier for the message. * - * @return topic of message. + * @return topic of the message. */ String getTopic(); /** - * Get the <strong>deep copy</strong> of message body, which means any modification of return value does not + * Get the <strong>deep copy</strong> of the message body, which means any modification of the return value does not * affect the built-in message body. * * @return the <strong>deep copy</strong> of message body. @@ -50,7 +50,7 @@ public interface MessageView { ByteBuffer getBody(); /** - * Get the <strong>deep copy</strong> of message properties, which makes the modification of return value does + * Get the <strong>deep copy</strong> of message properties, which makes the modifies of return value does * not affect the message itself. * * @return the <strong>deep copy</strong> of message properties. @@ -58,29 +58,29 @@ public interface MessageView { Map<String, String> getProperties(); /** - * Get the tag of message, which is the second classifier besides topic. + * Get the tag of the message, which is the second classifier besides the topic. * * @return the tag of message, which is optional, {@link Optional#empty()} means tag does not exist. */ Optional<String> getTag(); /** - * Get the key collection of message, which means any modification of return value does not affect the built-in - * message key collection. + * Get the key collection of the message, which means any modification of the return value does not affect the + * built-in message key collection. * - * @return copy of key collection of message, empty collection means message key is not specified. + * @return copy of the key collection of the message, empty collection means message key is not specified. */ Collection<String> getKeys(); /** - * Get the message group, which make sense only when topic type is fifo. + * Get the message group, which makes sense only when the topic type is FIFO(First In, First Out). * * @return message group, which is optional, {@link Optional#empty()} means message group is not specified. */ Optional<String> getMessageGroup(); /** - * Get the expected delivery timestamp, which make sense only when topic type is delay. + * Get the expected delivery timestamp, which makes sense only when the topic type is delay. * * @return message expected delivery timestamp, which is optional, {@link Optional#empty()} means delivery * timestamp is not specified. @@ -88,26 +88,26 @@ public interface MessageView { Optional<Long> getDeliveryTimestamp(); /** - * Get the born host of message. + * Get the born host of the message. * - * @return born host of message. + * @return born host of the message. */ String getBornHost(); Optional<String> getTraceContext(); /** - * Get the born timestamp of message. + * Get the born timestamp of the message. * * <p>Born time means the timestamp that the message is prepared to send rather than the timestamp the * {@link Message} was built. * - * @return born timestamp of message. + * @return born timestamp of the message. */ long getBornTimestamp(); /** - * Get the delivery attempt for message. + * Get the delivery attempt for the message. * * @return delivery attempt. */ diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Producer.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Producer.java index 1baae87..14b3f8d 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Producer.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Producer.java @@ -27,8 +27,8 @@ import org.apache.rocketmq.client.apis.message.Message; /** * Producer is a thread-safe rocketmq client which is used to publish messages. * - * <p>On account of network timeout or other reasons, rocketmq producer only promised the at-least-once semantics. - * For producer, at-least-once semantics means potentially attempts are made at sending it, messages may be + * <p>On account of network timeout or other reasons, the producer only promised the at-least-once semantics. + * For the producer, at-least-once semantics means potentially attempts are made at sending it, messages may be * duplicated but not lost. Especially, potentially attempts are not made using {@link #send(Message, Transaction)}. */ public interface Producer extends Closeable { @@ -37,17 +37,17 @@ public interface Producer extends Closeable { * * <p>This method does not return until it gets the definitive result. * - * @param message message to send. - * @return send receipt. + * @param message the message to send. + * @return the returned receipt. */ SendReceipt send(Message message) throws ClientException; /** * Sends a transactional message synchronously. * - * @param message message to send. - * @param transaction transaction to bind. - * @return send receipt. + * @param message the message to send. + * @param transaction the transaction to bind. + * @return the returned receipt. */ SendReceipt send(Message message, Transaction transaction) throws ClientException; @@ -56,8 +56,8 @@ public interface Producer extends Closeable { * * <p>This method returns immediately, the result is included in the {@link CompletableFuture}; * - * @param message message to send. - * @return a future that indicates send receipt. + * @param message the message to send. + * @return a future that indicates the send receipt. */ CompletableFuture<SendReceipt> sendAsync(Message message); @@ -69,7 +69,7 @@ public interface Producer extends Closeable { * <p>All messages to send should have the same topic. * * @param messages batch messages to send. - * @return collection indicates send receipt. + * @return collection indicates the send receipt. */ List<SendReceipt> send(List<Message> messages) throws ClientException; @@ -90,7 +90,7 @@ public interface Producer extends Closeable { Transaction beginTransaction() throws ClientException; /** - * Closes the producer and release all related resources. + * Closes the producer and releases all related resources. * * <p>This method does not return until all related resource is released. */ diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/ProducerBuilder.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/ProducerBuilder.java index 4e9f34f..7c6b80b 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/ProducerBuilder.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/ProducerBuilder.java @@ -26,7 +26,7 @@ import org.apache.rocketmq.client.apis.message.Message; */ public interface ProducerBuilder { /** - * Set the client configuration for producer. + * Set the client configuration for the producer. * * @param clientConfiguration client's configuration. * @return the producer builder instance. @@ -67,7 +67,7 @@ public interface ProducerBuilder { ProducerBuilder setMaxAttempts(int maxAttempts); /** - * Set the transaction checker for producer. + * Set the transaction checker for the producer. * * @param checker transaction checker. * @return the produce builder instance. @@ -80,7 +80,7 @@ public interface ProducerBuilder { * <p>The producer does a series of preparatory work during startup, which could help to identify more unexpected * error earlier. * - * <p>Especially, if this method is invoked more than once, different producer will be created and started. + * <p>Especially, if this method is invoked more than once, different producers will be created and started. * * @return the producer instance. */ diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/SendReceipt.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/SendReceipt.java index 60b447b..dc96f55 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/SendReceipt.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/SendReceipt.java @@ -20,7 +20,7 @@ package org.apache.rocketmq.client.apis.producer; import org.apache.rocketmq.client.apis.message.MessageId; /** - * A receipt from server, which only makes sense when message is sent successfully. + * A receipt from the server, which only makes sense when the message is sent successfully. */ public interface SendReceipt { MessageId getMessageId(); diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Transaction.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Transaction.java index adf46d3..6167407 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Transaction.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/Transaction.java @@ -22,8 +22,8 @@ import org.apache.rocketmq.client.apis.ClientException; /** * An entity to describe an independent transaction. * - * <p>Once request of commit of roll-back reached server, subsequent arrived commit or roll-back request in - * {@link Transaction} would be ignored by server. + * <p>Once the request of commit of roll-back reached server, subsequently arrived commit or roll-back request in + * {@link Transaction} would be ignored by the server. * * <p>If transaction is not commit/roll-back in time, it is suspended until it is solved by {@link TransactionChecker} * or reach the end of life. @@ -33,7 +33,7 @@ public interface Transaction { * Try to commit the transaction, which would expose the message before the transaction is closed if no exception * thrown. * - * <p>What you should pay more attention is that commit may be successful even exception thrown. + * <p>What you should pay more attention to is that the commitment may be successful even exception is thrown. */ void commit() throws ClientException; @@ -41,7 +41,7 @@ public interface Transaction { * Try to roll back the transaction, which would expose the message before the transaction is closed if no exception * thrown. * - * <p>What you should pay more attention is that roll-back may be successful even exception thrown. + * <p>What you should pay more attention to is that the roll-back may be successful even exception is thrown. */ void rollback() throws ClientException; } \ No newline at end of file diff --git a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/TransactionResolution.java b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/TransactionResolution.java index 00e6870..b4d1823 100644 --- a/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/TransactionResolution.java +++ b/java/client-apis/src/main/java/org/apache/rocketmq/client/apis/producer/TransactionResolution.java @@ -30,8 +30,8 @@ public enum TransactionResolution { */ ROLLBACK, /** - * Notify server that the state of this transaction is not sure. You should be cautions before return unknown - * because the examination from server will be performed periodically. + * Notify the server that the state of this transaction is not sure. You should be cautious before return unknown + * because the examination from the server will be performed periodically. */ UNKNOWN } diff --git a/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageIdCodec.java b/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageIdCodec.java index 5d313d8..4fbce06 100644 --- a/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageIdCodec.java +++ b/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageIdCodec.java @@ -26,13 +26,13 @@ import org.apache.rocketmq.client.apis.message.MessageId; import org.apache.rocketmq.client.java.misc.Utilities; /** - * The codec for the message id. + * The codec for the message-id. * * <p>Codec here provides the following two functions: - * 1. Provide decoding function of message id of all versions above v0. - * 2. Provide a generator of message id of v1 version. + * 1. Provide decoding function of message-id of all versions above v0. + * 2. Provide a generator of message-id of v1 version. * - * <p>The message id of versions above V1 consists of 17 bytes in total. The first two bytes represent the version + * <p>The message-id of versions above V1 consists of 17 bytes in total. The first two bytes represent the version * number. For V1, these two bytes are 0x0001. * * <h3>V1 message id example</h3>
