You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chent199 (via GitHub)" <gi...@apache.org> on 2024/07/20 06:02:21 UTC
[I] RocketMQ Error sending asynchronous message. However, the synchronization message is normal [rocketmq]
chent199 opened a new issue, #8415:
URL: https://github.com/apache/rocketmq/issues/8415
### Before Creating the Bug Report
- [X] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions).
- [X] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate.
- [X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
### Runtime platform environment
ubuntu 22.04.2
docker 26.1.4
### RocketMQ version
rocketmq 4.9.6
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.9.6</version>
</dependency>
### JDK Version
1.8.0
### Describe the Bug
RocketMQ Error sending asynchronous message. However, the synchronization message is normal
e = 发送失败:java.lang.IllegalStateException: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to [IP:9876] failed
### Steps to Reproduce
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.exception.RemotingException;
public class AsyncProducer {
public static void main(String[] args) throws MQClientException, RemotingException, InterruptedException, MQBrokerException {
DefaultMQProducer defaultMQProducer = new DefaultMQProducer("group1");
defaultMQProducer.setNamesrvAddr("localhost:9876");
defaultMQProducer.start();
defaultMQProducer.setRetryTimesWhenSendAsyncFailed(30);
Message message = new Message("topic","tag",("hello,rocketmq").getBytes());
// defaultMQProducer.send(message);
defaultMQProducer.send(message, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
System.out.println("发送成功:"+sendResult);
}
@Override
public void onException(Throwable e) {
System.out.println("e = " + "发送失败:"+e);
}
});
defaultMQProducer.shutdown();
}
}
run the code and failed
### What Did You Expect to See?
print success_info
### What Did You See Instead?
e = 发送失败:java.lang.IllegalStateException: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to [IP:9876] failed
### Additional Context
_No response_
--
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: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] RocketMQ Error sending asynchronous message. However, the synchronization message is normal [rocketmq]
Posted by "chent199 (via GitHub)" <gi...@apache.org>.
chent199 commented on issue #8415:
URL: https://github.com/apache/rocketmq/issues/8415#issuecomment-2240943229
I have found the solution. when I deleted "defaultMQProducer.shutdown();" ,it worked
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] RocketMQ Error sending asynchronous message. However, the synchronization message is normal [rocketmq]
Posted by "chent199 (via GitHub)" <gi...@apache.org>.
chent199 closed issue #8415: RocketMQ Error sending asynchronous message. However, the synchronization message is normal
URL: https://github.com/apache/rocketmq/issues/8415
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org