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:
[email protected]