4

After migrating our microservice functionality to Spring Cloud function we have been facing issues with one of the producer topics.

    Event of type: abc and key: xxx_yyy could not be sent to kafka org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder$ProducerConfigurationMessageHandler@2333d598]; nested exception is org.springframework.kafka.KafkaException: Send failed; nested exception is org.apache.kafka.common.errors.TimeoutException: Topic pc-abc not present in metadata after 60000 ms.
o.s.kafka.support.LoggingProducerListener - Exception thrown when sending a message with key='byte[15]' and payload='byte[256]' to topic pc-abc and partition 6: org.apache.kafka.common.errors.TimeoutException: Topic pc-abc not present in metadata after 60000 ms.

FYI: Topics are already created in our staging/prod environment and are not to be created as the application starts.

My producer config:

spring.cloud.stream.bindings.pc-abc-out-0.content-type=application/json
spring.cloud.stream.bindings.pc-abc-out-0.destination=pc-abc
spring.cloud.stream.bindings.pc-abc-out-0.producer.header-mode=headers
***spring.cloud.stream.bindings.pc-abc-out-0.producer.partition-count=5***
spring.cloud.stream.bindings.pc-abc-out-0.producer.partitionKeyExpression=payload.key
spring.cloud.stream.kafka.bindings.pc-abc-out-0.producer.sync=true

I am kind of stuck at this point and exhausted. Has anyone else faced this issue?

Spring Cloud version: 2.5.5 Kafka: 2.7.1

The issue is :

The producer is configured with partition-count=5

and Kafka is looking for partition number 6 , which obviously does not exist , I have commented the auto-add partitions property, but the issue still turns up !! Is it stale configuration? How do I force kafka to take up new configuration.

FenderBender
  • 87
  • 1
  • 9
  • `ProducerConfigurationMessageHandler` sounds like it is the Producer, not an AdminClient. Kafka includes Jackson transitively, not sure how that would fix timeout exceptions – OneCricketeer Jan 18 '22 at 18:27
  • Thank you for your response. I understand , it was just one of the solutions I tried , I have updated my producer config in the question as well. Regarding Adminclient , I had a doubt if it being 'unregistered' had to do something with metadata not being refreshed. – FenderBender Jan 20 '22 at 08:34

0 Answers0