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 2021/03/08 04:50:51 UTC

[GitHub] [rocketmq] bigyShot opened a new issue #2717: Exception when sending replyMsg in ResponseConsumer

bigyShot opened a new issue #2717:
URL: https://github.com/apache/rocketmq/issues/2717


   我在用官方给的例子代码(Example模块下的rpc包)测试request调用的时候,先启动了Broker(默认配置),设置了namesrvAddr和topic之后,先启动了ResponseComsumer,然后启动了RequestProducer,消息发过去之后却等待超时报错了,然后看消费者那边是在发送回复消息的时候失败了,发现是发送回复消息的时候回复消息的Topic的值不符合检测的正则表达式,Topic的为 
       "DefaultCluster _REPLY_TOPIC",其中多包含了一个空格.
   我检查Broker模块,发现BrokerConfig的clusterName是没有多一个空格的,但是消费者接收到的clusterName却多了一个空格,不知道什么原因,暂时是在MessageUtil创建回复消息的时候处理了一下ClusterName的空格解决了这个问题.
   First,I started the Example.ResponseConsumer.main(),then i started the RequestProducer.main() to send some msgs.All as defalut settings except  namesrvAddr and topic.But when responseConsumer send replyMsg,it occurs:
   
   `org.apache.rocketmq.client.exception.MQClientException: The specified topic[DefaultCluster _REPLY_TOPIC] contains illegal characters, allowing only ^[%|a-zA-Z0-9_-]+$
   For more information, please visit the url, http://rocketmq.apache.org/docs/faq/
   	at org.apache.rocketmq.client.Validators.checkTopic(Validators.java:111)
   	at org.apache.rocketmq.client.Validators.checkMessage(Validators.java:87)
   	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:558)
   	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1373)
   	at org.apache.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:344)
   	at org.apache.rocketmq.example.rpc.ResponseConsumer$1.consumeMessage(ResponseConsumer.java:70)
   	at org.apache.rocketmq.client.impl.consumer.ConsumeMessageConcurrentlyService$ConsumeRequest.run(ConsumeMessageConcurrentlyService.java:412)
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
   	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)`
   Then i debug it,I found the msgs's CLUSTER proerty is "DefaultCluster " which responseConsumer got,It will use it's CLUSTER to combine Topic's name in MessageUtil when create replyMsgs,Finally the Topic's name became "DefaultCluster _REPLY_TOPIC",it include a whitespace,this violate the Topic's Regular Expression.
   So the problem is the msgs's CLUSTER propery is "DefaultCluster " which consumer got,and MessageUtil didn't deal the whitespace when it combine Topic's name.
   So i change sth and get it done.
   
   before:`String replyTopic = MixAll.getReplyTopic(cluster);`
   after:`String replyTopic = MixAll.getReplyTopic(cluster.replace(" ",""));`
   Still don't know  what happend in broker,Why clusterName with a plus whitespace
   
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] bigyShot commented on issue #2717: Exception when sending replyMsg in ResponseConsumer

Posted by GitBox <gi...@apache.org>.
bigyShot commented on issue #2717:
URL: https://github.com/apache/rocketmq/issues/2717#issuecomment-793275397


   找到原因了,不知道哪次启动的时候自动初始化创建了一个conf目录,然后里面自动生成的broker.conf的clusterName多了一个空格,然后属性混淆的时候就把这个里面的混淆给了brokerConfig对象


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] RongtongJin commented on issue #2717: Exception when sending replyMsg in ResponseConsumer

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #2717:
URL: https://github.com/apache/rocketmq/issues/2717#issuecomment-792726320


   是不是broker配置文件中的brokerClusterName多个空格?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] bigyShot closed issue #2717: Exception when sending replyMsg in ResponseConsumer

Posted by GitBox <gi...@apache.org>.
bigyShot closed issue #2717:
URL: https://github.com/apache/rocketmq/issues/2717


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] bigyShot commented on issue #2717: Exception when sending replyMsg in ResponseConsumer

Posted by GitBox <gi...@apache.org>.
bigyShot commented on issue #2717:
URL: https://github.com/apache/rocketmq/issues/2717#issuecomment-792780658


   > 是不是broker配置文件中的brokerClusterName多个空格?
   
   没有啊,下载的整个源码包,没改broker包下的代码的,还特意去看了brokerConfig那个类,也没得空格。


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org