private ProducerBuilder createProducer()

in rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ExtTemplateResetConfiguration.java [101:125]


    private ProducerBuilder createProducer(ExtProducerResetConfiguration annotation) {
        RocketMQProperties.Producer producerConfig = rocketMQProperties.getProducer();
        if (producerConfig == null) {
            producerConfig = new RocketMQProperties.Producer();
        }
        String topic = environment.resolvePlaceholders(annotation.topic());
        topic = StringUtils.hasLength(topic) ? topic : producerConfig.getTopic();
        String endpoints = environment.resolvePlaceholders(annotation.endpoints());
        endpoints = StringUtils.hasLength(endpoints) ? endpoints : producerConfig.getEndpoints();
        String accessKey = environment.resolvePlaceholders(annotation.accessKey());
        accessKey = StringUtils.hasLength(accessKey) ? accessKey : producerConfig.getAccessKey();
        String secretKey = environment.resolvePlaceholders(annotation.secretKey());
        secretKey = StringUtils.hasLength(secretKey) ? secretKey : producerConfig.getSecretKey();
        String namespace = environment.resolvePlaceholders(annotation.namespace());
        namespace = StringUtils.hasLength(namespace) ? namespace : producerConfig.getNamespace();
        int requestTimeout = annotation.requestTimeout();
        Boolean sslEnabled = producerConfig.isSslEnabled();
        ClientConfiguration clientConfiguration = RocketMQUtil.createClientConfiguration(accessKey, secretKey,
            endpoints, Duration.ofSeconds(requestTimeout), sslEnabled, namespace);
        final ClientServiceProvider provider = ClientServiceProvider.loadService();
        ProducerBuilder producerBuilder = provider.newProducerBuilder()
                .setClientConfiguration(clientConfiguration).setMaxAttempts(annotation.maxAttempts())
                .setTopics(topic);
        return producerBuilder;
    }