admin管理员组

文章数量:1134569

I am using kafka consumer which is up and running in my local. But when I add producer configs to post kafka message, its keep on disconnecting.

Below are the error logs

2025-01-07T18:36:42.133-08:00  INFO 70470 --- [kafka-producer-network-thread | producer-1] org.apache.kafka.clients.NetworkClient   : [Producer clientId=producer-1] Cancelled in-flight API_VERSIONS request with correlation id 85 due to node -6 being disconnected (elapsed time since creation: 27ms, elapsed time since send: 27ms, request timeout: 30000ms)
2025-01-07T18:36:42.133-08:00  WARN 70470 --- [kafka-producer-network-thread | producer-1] org.apache.kafka.clients.NetworkClient   : [Producer clientId=producer-1] Bootstrap broker aa.test:9092 (id: -6 rack: null) disconnected
2025-01-07T18:36:42.190-08:00  INFO 70470 --- [RMI TCP Connection(2)-127.0.0.1] o.a.k.clients.producer.KafkaProducer     : [Producer clientId=producer-1] Closing the Kafka producer with timeoutMillis = 30000 ms.

Producer bean

@Bean
    public ProducerFactory<String, String> enterpriseProducerFactory() throws IOException {
        Map<String, Object> configProps = new HashMap<>();
        configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, aksBootStrapServers);
        configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
        configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);

        // Enterprise Kafka Config
        configProps.put(SECURITY_PROTOCOL, securityProtocol);
        configProps.put(SASL_MECHANISM, saslMechanism);
        configProps.put(SSL_TRUSTSTORE_LOCATION, resourceFile.getFile().getAbsolutePath());
        configProps.put(SSL_TRUSTSTORE_PASSWORD, trustStorePassword);
        configProps.put(SASL_JAAS_CONFIG, saslJaasConfig);

        return new DefaultKafkaProducerFactory<>(configProps);
    }

The same setup is working in other spring boot microservice apps. Its just that this is happening in one of the apps where I am adding this new producer setup. Am I missing something basic? I enabled TRACE logging but didn't find anything useful to fix this issue.

本文标签: spring kafka producers disconnectingStack Overflow