Ingesting Websocket Data for Live Stock Streams with Cloudera Flow Management Powered by Apache NiFi
The stocks I follow have a lot of trades and changes throughout the day, I would like to capture all of this data and make it available to my colleagues. I will push it to Kafka and make it available via a topic and I may also push it to Slack or Dischord or a webpage or dashboard or Cloudera Visual App dashboard. We'll see what people request.
As updates happen we receive websocket calls and send them to Kafka for use in Flink SQL, Kafka Connect, Spark Streaming, Kafka Streams, Python, .Java Spring Boot Apps, NET Apps and NIFi.
UNIX milliseconds timestamp.
List of trade conditions. A comprehensive list of trade conditions code can be found here
We parse out the fields we want, then rename them for something readable. Then we build a new JSON field that matches our trades schema then we push to Kafka.
First step we need to setup a controller pool to connect to finnhub's web socket API.
We can see data in flight via NiFi Provenance.
The detailed steps and settings for converting raw websocket text messages to final messages to send to Kafka.
Raw Data From Websockets Text Message
Formatted JSON Data Before Converting and Sending to Kafka Topic (trades)
We can view the final clean data in Kafka via Cloudera Streams Messaging Manager (SMM)
Happy Holidays from Tim and the Streaming Felines!
Related Youtube Video