I want to consume messages from my Kafka broker using a spring boot configured consumer using the spring-Kafka library, the source is a JDBC connector which is responsible for pulling messages from a MySQL database and these messages need to be consumed
Below I am attaching my application.yml file
server:
port: 9000
spring:
kafka:
consumer:
bootstrap-servers: localhost:9092
group-id: group_id
auto-offset-reset: earliest
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
producer:
bootstrap-servers: localhost:9092
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.apache.kafka.common.serialization.StringSerializer
Consumer -
@KafkaListener(topics = "Sample-Topic", groupId = "group_id")
public void consume(String message) throws IOException {
System.out.println(message);
}
Messages in topics are stored in Avro format as I am using JDBC connector.
Instead of the JSON, I am getting encrypted output and some of the output messages are only plain strings.