private DefaultLitePullConsumer createConsumer()

in rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/autoconfigure/ExtConsumerResetConfiguration.java [106:137]


    private DefaultLitePullConsumer createConsumer(ExtRocketMQConsumerConfiguration annotation)
            throws MQClientException {

        RocketMQProperties.PullConsumer consumerConfig = rocketMQProperties.getPullConsumer();
        if (consumerConfig == null) {
            consumerConfig = new RocketMQProperties.PullConsumer();
        }
        String nameServer = resolvePlaceholders(annotation.nameServer(), rocketMQProperties.getNameServer());
        String groupName = resolvePlaceholders(annotation.group(), consumerConfig.getGroup());
        String topicName = resolvePlaceholders(annotation.topic(), consumerConfig.getTopic());
        Assert.hasText(nameServer, "[nameServer] must not be null");
        Assert.hasText(groupName, "[group] must not be null");
        Assert.hasText(topicName, "[topic] must not be null");

        String accessChannel = resolvePlaceholders(annotation.accessChannel(), rocketMQProperties.getAccessChannel());
        MessageModel messageModel = annotation.messageModel();
        SelectorType selectorType = annotation.selectorType();
        String selectorExpression = resolvePlaceholders(annotation.selectorExpression(), consumerConfig.getSelectorExpression());
        String ak = resolvePlaceholders(annotation.accessKey(), consumerConfig.getAccessKey());
        String sk = resolvePlaceholders(annotation.secretKey(), consumerConfig.getSecretKey());
        int pullBatchSize = annotation.pullBatchSize();
        //If the string is not equal to "true", the TLS mode will be represented as the default value of false
        boolean useTLS = new Boolean(environment.resolvePlaceholders(annotation.tlsEnable()));
        DefaultLitePullConsumer litePullConsumer = RocketMQUtil.createDefaultLitePullConsumer(nameServer, accessChannel,
                groupName, topicName, messageModel, selectorType, selectorExpression, ak, sk, pullBatchSize, useTLS);
        litePullConsumer.setEnableMsgTrace(annotation.enableMsgTrace());
        litePullConsumer.setCustomizedTraceTopic(resolvePlaceholders(annotation.customizedTraceTopic(), consumerConfig.getCustomizedTraceTopic()));
        String namespace = environment.resolvePlaceholders(annotation.namespace());
        litePullConsumer.setNamespace(RocketMQUtil.getNamespace(namespace, consumerConfig.getNamespace()));
        litePullConsumer.setInstanceName(annotation.instanceName());
        return litePullConsumer;
    }