I sat down to follow the Write a Streams Application tutorial just to get a taste of the Streams API. Boy was I in for a headache!
The API is implemented using some modern Java (JDK 8) and I found it did not play well with Scala AT ALL. It was a pure bash-my-head-into-the-wall session until I got it working.
The problem was with the type-casting interop between Java and Scala. It is not a clean interop. Here’s the code I used to convert part of that tutorial I mentioned above to Scala. Once my headache goes away I may try to get a little further.
in build.gradle
scala code:
Since the Kafka Producer and Consumer APIs are so clear and easy to use I would much rather build an application using those, compared to this streaming business. perhaps that will change as I get more experience. But for now, I’d prefer to keep it straightforward with the old school ways.