Skip to content

How do I leverage existing KafkaTemplate from Producer config in RetryTopicConfiguration? #2637

Closed Answered by gpando
hariraogotit asked this question in Q&A
Discussion options

You must be logged in to vote

Use a qualifier:

 @Bean(name = "mykafkatemplate")
 KafkaTemplate<String, byte[]>  getSdKafkaTemplate(
      @Value("${spring.kafka.bootstrap-servers}") String sdServers) {   
      return getProducerTemplate(sdServers, bufferMemory, securityProtocol);   
  }   

 @bean
 public RetryTopicConfiguration myRetryTopic(@Qualifier("mykafkatemplate") KafkaTemplate<String, byte[]> kafkaTemplate) {
  ...

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@garyrussell
Comment options

Answer selected by hariraogotit
Comment options

You must be logged in to vote
1 reply
@hariraogotit
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants