In the last recipe, the Reader has the invocation of the process method. This method belongs to the Producer class. In this recipe, the Writer class is explained.
Writing to Kafka
Getting ready
The execution of the previous recipes in this chapter is needed.
How to do it...
As we did with the Consumer interface, the Producer interface is needed to keep things flexible. The two producers in this chapter will implement the Producer interface. This interface isolates all the common behavior of the producers.
Copy the following content to a file called src/main/java...