0
votes

I am working on kafka and spring boot application. I am writing a file to drive using java File api. File data is in database. I have repository and service layer in application. If file size is greater than 50MB then I am calling kafka producer and pass a List of Id's as value. Can I call Service methods to pull data In my kafka Consumer?

1

1 Answers

0
votes

What do you mean "If file size is greater than 50MB then I am calling kafka producer and pass a List of Id's as value" ? All you need to do only write a Kafka producer to send data to Kafka cluster and a Kafka consumer to pull records from Kafka cluster then write to file in drive.

Because you use Spring Boot for your project you can use query methods in your repository class to pull data from database, pass through your service layer then Kafka producer will do its job. In your Kafka consumer you just need to consume records by using @KafkaListener annotation of Spring Kafka. So many sample codes you can find by few Google search.