1

I am trying to configure the Confluent - ConsumerTimestampsInterceptor to support the Confluent KAFKA Replication and have configured Java spring boot application as mentioned below

application.properties

#consumer timestamp interceptor
interceptor.classes=io.confluent.connect.replicator.offsets.ConsumerTimestampsInterceptor
timestamp.producer.security.protocol=PLAINTEXT
timestamp.producer.sasl.mechanism=NONE
#timestamp.producer.ssl.endpoint.identification.algorithm=
#timestamp.producer.sasl.jaas.config=
src.consumer.group.id=lkc-302y2

Consumer.java

package com.example.demo.service;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

import com.example.demo.model.ProductKafka;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.LinkedList;
import java.util.Queue;
import java.util.logging.Logger;

@Service
public class Consumer {
    private static final Logger LOGGER = Logger.getLogger(Consumer.class.getName());
    public static ArrayDeque<ProductKafka> consumeQueue = new ArrayDeque<>();
    
    @KafkaListener(autoStartup = "false", topics = "#{'${spring.kafka.topics}'.split('\\\\ ')}", groupId = "#{'${spring.kafka.groupId}'}")
    public void consume(ProductKafka productKafka) throws IOException {
        consumeQueue.offer(productKafka);

        LOGGER.info(String.format("#### -> Logger Consumed message -> %s", productKafka.toString()));
        System.out.printf("#### -> Consumed message -> %s", productKafka.toString());
    }
}

and below is the project structure

enter image description here

however it is not working.

Our KAFKA administrator mentioned that though I have the Interceptor added KAFKA consumer is not configured to use the interceptor.

I don't know how to make the consumer use the Interceptor

Jim Bethancourt
  • 1,061
  • 11
  • 16
One Developer
  • 99
  • 5
  • 43
  • 103

0 Answers0