From the course: Stream Processing Design Patterns with Kafka Streams
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Real-time predictions: Helper classes - Kafka Tutorial
From the course: Stream Processing Design Patterns with Kafka Streams
Real-time predictions: Helper classes
- [Instructor] I will discuss the helper classes for generating review data, and running an embedded HTTPServer for streaming predictions in this video. The implementation is available in the package com.learning.kafkastreaming.chapter5. First let's look at the RunLocalWebServer class. This class starts a HTTP web server on the 8001 port. It supports an endpoint called "/sentiment". The associated handler for the sentiment is the SentimentHTTPHandler class. Each time a request comes for sentiment. It is sent to the SentimentHTTPHandler class. The text input is provided in the request body. Let's explore the SentimentHTTPHandler class now. This class implements the HTTPHandler interface. When a request comes in it is sent to the handle function. The handle function extracts the request body and calls the getSentiment method. The getSentiment, method uses, StanfordCoreNLP library for sentiment analysis. Here, we first set up…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.