aaron-ai commented on issue #3973:
URL: https://github.com/apache/rocketmq/issues/3973#issuecomment-1092396888

   > @aaron-ai Some optimized suggestion about api-module, please take a look.
   > 
   > 1. Create masker interface `ErrorClassification`, and replace `ErrorCode` 
with `ErrorClassification` in `ClientException`. I think developer need custom 
error type, such as limitation;
   > 2. Replace `CompletableFuture` with `Future` in `Producer#sendAsync`, 
since `Future` is more extensibie. the default implementation of 
`Producer#sendAsync` still can use `CompletableFuture`;
   > 3. Replace  `BackoffRetryPolicy` with `RetryPolicy` in 
`ProducerBuilder#setRetryPolicy `.
   > 
   > #### Describe in Chinese
   > 您好,关于 api-module 有些建议请评估是否采纳:
   > 
   > 1. 
创建标记接口`ErrorClassification`、并使`ErrorCode`实现该接口,`ClientException`中`ErrorCode`替换为`ErrorClassification`。因为我认为开发者经常需要自定义异常和异常类型,例如限流,而现在的接口设计其实也支持用户自定义异常;
   > 2. 
在`Producer#sendAsync`中使用`Future`替换`CompletableFuture`,因为前者已经可以满足接口需要,我们可以再具体实现中在返回`CompletableFuture`;
   > 3. 在`ProducerBuilder#setRetryPolicy`中使用`RetryPolicy`替换 
`BackoffRetryPolicy`。
   
   Thanks for your suggestion, here is my opinion:
   1. Yes, as you say, error code may be added frequently, what's more, the new 
APIs is intend to unify both of RemotingCommand-based client and gRPC-based 
client #3949 , we need a looser structure to define error code here, so the 
existing design may be updated in subsequent pull request, welcome to be 
involved in the code review :)
   2. `CompletableFuture` may be essential, which allows users add their 
callback easily.
   3. In most case, `BackoffRetryPolicy` is enough, so we are not sure about 
that whether it is time to replace `BackoffRetryPolicy` by `RetryPolicy` now, a 
customized `RetryPolicy` which is not well-designed may be harmful to the 
server side, which is we are worried about. The design of `BackoffRetryPolicy` 
is refer to gRPC, and has undergone a long-term practice.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to