You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/03/30 02:07:40 UTC
[GitHub] [rocketmq] XiaoyiPeng opened a new issue #4060: The list of exception declarations in the send method signature cannot contain all exceptions that may be encountered when sending a message
XiaoyiPeng opened a new issue #4060:
URL: https://github.com/apache/rocketmq/issues/4060
**BUG REPORT**
1. Please describe the issue you observed:
When I send messages using `TransactionMQProducer`, I encounter a `java.lang.IllegalStateException` which is not in the list of exception declarations in the send method signature
```java
DefaultMQProducer#send(Message msg)
throws MQClientException, RemotingException,
MQBrokerException, InterruptedException
```
as below shown:
![image](https://user-images.githubusercontent.com/8653312/160734718-0022c8c4-7e55-4e76-8e68-cdfe99c5c9d1.png)
It's due to method `MQClientInstance#updateTopicRouteInfoFromNameServer`, when it catch `RemotingException`, a `IllegalStateException` is rethowed.
as shown below:
![image](https://user-images.githubusercontent.com/8653312/160735411-31440412-8163-4890-8c76-1c0e33a1e4e7.png)
It would be better to throw the caught `RemotingException` here.
In addition, many methods in **client API** , if they interact with the broker side, It would be better to declaring `RemotingException` in their method signatures, eg:
```java
long maxOffset(final MessageQueue mq) throws MQClientException;
```
2. Please tell us about your environment:
OS:Windows10
branch: develop
3. Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):
--
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: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org