rocketmq-spring icon indicating copy to clipboard operation
rocketmq-spring copied to clipboard

Add default consumer namespace to DefaultRocketMQListenerContainer

Open rainsoft opened this issue 3 years ago • 1 comments

The issue tracker is ONLY used for bug report and feature request.

Any question or RocketMQ proposal please use our mailing lists.

FEATURE REQUEST

  1. Please describe the feature you are requesting. 2.2.2版本添加了namespace配置,但是对于@RocketMQMessageListener,需要在每个注解中设置namespace, 能否通过rocketmq.consumer.namespace设置默认的namespace?

  2. Provide any additional detail on your proposed use case for this feature.

private DefaultRocketMQListenerContainer createRocketMQListenerContainer(String name, Object bean,
        RocketMQMessageListener annotation) {
              ......
        container.setMessageConverter(rocketMQMessageConverter.getMessageConverter());
        container.setName(name);

        // set default namespace
        String namespace = rocketMQProperties.getConsumer().getNamespace();
        if (StringUtils.isEmpty(container.getNamespace()) && !StringUtils.isEmpty(namespace)) {
            container.setNamespace(namespace);
        }

        return container;
    }
  1. Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue? should-have

rainsoft avatar Apr 08 '22 06:04 rainsoft

namespace is used for logical isolation. If a default value is set for namespace, the actual resource will become namespace%topic or namespace%group, which is not friendly to users of rocketmq who are not familiar with it.

panzhi33 avatar Jun 20 '22 08:06 panzhi33

I only add the default namespace for consumer, not both producer and consumer, which may not works well. I will test it, if there are any questions, I will submit another PR to fix it.

zhouhai22 avatar Aug 19 '22 00:08 zhouhai22