Location temperature enricher
The next step is to enrich the messages with the geolocation information. The third step is to enrich the message with the temperature.
Getting ready
Recapitulating, the specification is to create a stream application that does the following:
- Reads individual messages from a Kafka topic called raw-messages
- Enriches the messages with the geolocalization of the machine's IP address
- Enriches the messages with the weather information of the geolocalization
- Writes the correct events in a Kafka topic called enriched-messages
How to do it...
Modify the Enricher.java
file in the src/main/java/treu/
directory with the following contents:
package treu; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.ObjectNode; import com.maxmind.geoip.Location; import treu.extractors.GeoIP; import treu.extractors.OpenWeather; import java.io.IOException; import org.apache.kafka.clients.producer.*; public class Enricher implements Producer { ...