Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The response results of rocketmqtemplate and defaultmqproducer sendstatus are inconsistent #365

Closed
Bin2020 opened this issue May 12, 2021 · 2 comments · Fixed by #388
Closed
Labels
bug Something isn't working

Comments

@Bin2020
Copy link

Bin2020 commented May 12, 2021

broker 1主1从同步双写,从broker宕机,发送同步消息。RocketMQTemplate应答SEND_OK,DefaultMQProducer应答SLAVE_NOT_AVAILABLE,为什么

SendResult sendResult = rocketMQTemplate.syncSend("testTopic", "test");
System.out.println(sendResult.getSendStatus()); // SEND_OK
DefaultMQProducer producer = new TransactionMQProducer("my-group2");
producer.setNamesrvAddr("127.0.0.1:9876");
producer.start();

org.apache.rocketmq.common.message.Message msg = new org.apache.rocketmq.common.message.Message("testTopic", "test".getBytes(StandardCharsets.UTF_8));
SendResult sendResult2 = producer.send(msg);
System.out.println(sendResult2.getSendStatus()); // SLAVE_NOT_AVAILABLE
@RongtongJin RongtongJin changed the title RocketMQTemplate与DefaultMQProducer sendStatus应答结果不一致 The response results of rocketmqtemplate and defaultmqproducer sendstatus are inconsistent May 14, 2021
@Bin2020
Copy link
Author

Bin2020 commented May 20, 2021

在org.apache.rocketmq.spring.support.RocketMQUtil#getAndWrapMessage方法下,WAIT_STORE_MSG_OK默认为false,但是设计上应该是想默认true的,是BUG吧。

Object waitStoreMsgOkObj = headers.getOrDefault("WAIT_STORE_MSG_OK", "true");
rocketMsg.setWaitStoreMsgOK(Boolean.TRUE.equals(waitStoreMsgOkObj)); // Boolean.TRUE.equals("true") always false

@RongtongJin
Copy link
Contributor

在org.apache.rocketmq.spring.support.RocketMQUtil#getAndWrapMessage方法下,WAIT_STORE_MSG_OK默认为false,但是设计上应该是想默认true的,是BUG吧。

Object waitStoreMsgOkObj = headers.getOrDefault("WAIT_STORE_MSG_OK", "true");
rocketMsg.setWaitStoreMsgOK(Boolean.TRUE.equals(waitStoreMsgOkObj)); // Boolean.TRUE.equals("true") always false

这确实是个bug,有兴趣提交一个pr来修复它吗?

@RongtongJin RongtongJin added the bug Something isn't working label Sep 12, 2021
RongtongJin added a commit to RongtongJin/rocketmq-spring that referenced this issue Sep 14, 2021
…ltmq producer send status are inconsistent
RongtongJin added a commit to RongtongJin/rocketmq-spring that referenced this issue Sep 14, 2021
odbozhou pushed a commit that referenced this issue Sep 14, 2021
* [ISSUE #365]The response results of rocketmq template and defaultmq producer send status are inconsistent

* [ISSUE #365] Remove useless code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants