SlideShare a Scribd company logo
#ActiveUIDevoxxUK @lucasjellema
Real Time UI with Apache Kafka
Streaming Analytics of Fast Data and Server Push
Lucas Jellema (CTO AMIS)
@lucasjellema
http://technology.amis.nl
www.amis.nl
Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push
Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push
Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push
<Middleware>
F5
F5
F5
CTRLF5
CTRLF5
CTRLF5
<Middleware>
F5
F5
F5
CTRLF5
CTRLF5
CTRLF5
<Middleware>
F5
F5
F5
CTRLF5
CTRLF5
CTRLF5
FAST DATA AND ACTIVE UI
• Handle [data | event] influx
• Analyze in real time
• Publish findings instantaneously
• Update UI & notify end user immediately
• Convince end user that the UI is (still) active (and no F5 is required)
• Decoupled components
• No data loss when a component is temporarily down
• Scalable with volume of events and of number of clients
API
µ
µ
µ
µ
THE CASE AT HAND
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
tags
Show live
tweet
aggregates
per tag
Allow users to
like tweets –
and show live
list of liked
tweets
Show a live
list of top 3
liked tweets
per tag
Standin for all
Hot Sources of Live Data:
IoT Physical World Reports, IT Ops, Web
Click Statistics, Business Process
execution, open data feeds (traffic,
weather, stocks, …), Points of Sales,
Social Media, microservices chatter
THE CODE
https://github.com/lucasjellema/devoxxUK18-active-ui-streaming-analysis
#ActiveUIDevoxxUK
FOLLOWING ALONG (AND HELP WITH) THE DEMO
http://bit.ly/ActiveUIDevoxxUK
EVENTS
Producers
Consumers
Robust, Scalable,
History Retention
Containerized/Cloud-
enabled
INTRODUCING APACHE KAFKA
• ..- 2010 – creation at Linkedin
• Message Bus | Event Broker | Streaming Data Platform
• High volume, low latency, highly reliable, cross technology Commit Log (ledger)
• Scalable (#messages & #consumers), distributed, durable, strict message ordering, ….
• 2011/2012 – open source under the Apache Incubator/ Top Project
• Backed by Confluent – Confluent Open Source & Confluent Enterprise
• Kafka is used by most many [large] corporations:
• And embraced by [almost] all many software vendors & cloud providers
• Client libraries available for NodeJS, Java, C/C++, Python, Ruby, PHP, Scala,
Clojure, Rust, .NET, go (aka golang) and many more
• Apache Kafka includes Connect, Mirror Maker, Streams
• KSQL is Open Source, part of the Confluent Platform
Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push
KAFKA TERMINOLOGY
• Topic
• partition
• Message
• == ByteArray
• Broker
• replicated
• Producer
• Consumer
• Working together
in Consumer Groups
Producer Consumer
Topic
Broker
Key
Value
Time
Message
Producers
Consumers
Topic
Broker
tcp
tcp
THE CASE AT HAND – STEP ONE
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
in each client
Tweets
Topic
THE CASE AT HAND – STEP ONE AND A HALF
Client
Client
Client
Client
Tweets on
#devoxxUK #java
#oraclecode
Show live
tweet feed for
each tag
in each client
Tweets
Topic
THE CASE AT HAND – STEP ONE AND TWO
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
Oracle Cloud
Event HubApplication
Container
Tweets
Topic
Event Hub
Application
Container
Application
Container
KAFKA CONSUMER IN NODE
GETS EVENTS PUSHED INTO APPLICATION
WEB APP REGISTERS LISTENER WITH KAFKA
EVENT CONSUMER
THE CASE AT HAND
SERVER SENT EVENTS FOR PUSH BACK
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
Server Sent
Event
SERVER SENT EVENT – SERVER SIDE
SERVER SENT EVENT – CLIENT SIDE
LIVE TWEET STREAM
Server Sent
Event
THE CASE AT HAND
TWEET LIKES – CLIENT TO SERVER TO ALL CLIENTS
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
SSE
Allow users to
like tweets –
and show live
list of liked
tweets
THE CASE AT HAND
WEB SOCKETS – FOR BI DIRECTIONAL PUSH
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
SSE
WebSockets
Allow users to
like tweets –
and show live
list of liked
tweets
WEBSOCKETS – SERVER SIDE
WEBSOCKETS – CLIENT SIDE - PUBLISHING
Client WebSockets
WEBSOCKETS – CLIENT SIDE - CONSUMING
Client WebSockets
TWEET LIKES BROADCASTING
WebSockets
WebSockets
THE CASE AT HAND: RUNNING COUNT
STREAMING ANALYSIS OF TWEET EVENTS
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
SSE
WebSockets
Allow users to
like tweets –
and show live
list of liked
tweets
Show live
tweet
aggregates
per tag
THE CASE AT HAND - STREAMING ANALYSIS OF TWEETS
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
WebSockets
Allow users to
like tweets –
and show live
list of liked
tweets
Show live
tweet
aggregates
per tag
tweetAnalytics
Topic
Streaming
Tweets
Aggregation
µ
SSE
KAFKA STREAMS
• Real Time Event [Stream] Processing integrated into Kafka
• Aggregations & Top-N
• Time Windows
• Continuous Queries
• Latest State (event sourcing)
• Turn Stream (of changes) into Table
(of most recent or current state)
• Part of the state can be quite old
• Exactly-once processing in Kafka Streams (as of 0.11.0)
• Note: Kafka Streams is relatively new
• Only support for Java clients; Scala client is planned too
KAFKA STREAMS
Topic
Filter
Aggregate
Join
Topic
Map (Xform)
Publish
Topic
EXAMPLE OF KAFKA STREAMS
Topic
groupBy
Aggregate
Join
Topic
Map (Xform)
Publish
TweetMessage
Tag
Text
Author
Set Conference as key
Sum/Avg/Top3 by key
(==tagFilter)
As JSON
Round aggregate to
nearest 100
e.g. Author Details
Topic: CountTweetsPerTag
and possibly per time window
ADD KAFKA STREAMS CAPABILITIES TO ANY
JAVA APPLICATION
• Add Maven Dependency
• Connect to Kafka Cluster
• Compose & Execute Kafka Streams logic:
• Write Java code
KAFKA STREAMS –
RUNNING COUNT TWEETS PER CONFERENCE
WOULDN’T IT BE NICE IF YOU COULD JUST DO
select tagfilter
, count(*) as tag_cnt
from tweets
window hopping ( size 5 minutes
, advance by 30 seconds)
group by tagfilter
KSQL – CONTINUOUS QUERIES –
PROCESSING EVENT STREAMS LIKE TABLES
• Transform, Filter, Join, Aggregate, (time) Window on Event Streams
• Results are produced as regular Kafka Events
RUNNING TWEET COUNT THROUGH KSQL
RUNNING TWEET COUNT THROUGH KSQL
• KSQL CLI
• List topics
• Print topic
• Create stream
• Create table
• List Topics
• Query from table
RUNNING TWEET COUNT THROUGH KSQL
KSQL RUNNING COUNT OF TWEETS PER TAG
RESULTS PUBLISHED ON KAFKA TOPIC
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
Allow users to
like tweets –
and show live
list of liked
tweets
Show live
tweet
aggregates
per
conference
TWEET_COUNT
Topic
Running Tweets
Aggregation
SSE
Show a live
list of top 3
liked tweets
per tag
STREAMING TWEET ANALYTICS - PUSHED TO CLIENT
Server Sent
Event
KSQL INTERFACES
Kafka Cluster
Kafka Streams API
KSQL Server
HTTP
REST API
CLI
JDBC
Driver
KTable
KStream
Topic
Topic
Topic
KTable
Topic
Topic
Java Application
KStream
THE THREE FLAVORS OF
STREAM[ING] ANALYTICS WITH KAFKA
Kafka Cluster
KTable
KStream
Topic
Topic
Topic
KTable
Topic
Topic
KStream
THE CASE AT HAND –
STREAMING ANALYSIS OF TWEET LIKES
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Show live
tweet feed for
each tag
Tweets
Topic
WebSockets
Allow users to
like tweets –
and show live
list of liked
tweets
Show live
tweet
aggregates
per
conference
TWEET_COUNT
Topic
Running Tweets
Aggregation
SSE
Show a live
list of top 3
liked tweets
per tag
THE CASE AT HAND - STREAMING ANALYSIS
OF TWEET LIKES
Client
Client
Client
Client
Tweets on #devoxxUK
#java #oraclecode
Tweets
Topic
WebSockets
TWEET_COUNT
Topic
Running Tweets
Aggregation
SSE
Show a live
list of top 3
liked tweets
per tag
Tweet-Like
Topic
Running Top3 Like
Counts Aggregation
Tweet_Like_
Counts
Topic
WEBSOCKETS – SERVER SIDE
PRODUCE TWEET LIKE EVENTS
CREATE STREAM FROM TOPIC & TABLE FROM
STREAM
create stream tweet_likes ( tweetid varchar)
with (kafka_topic='tweet-like_topic' ,
value_format='json', key='tweetid');
create table like_counts as
select count(*) likecount
, tweetid
, tagfilter
from tweet_likes
window hopping ( size 60 seconds
, advance 10 seconds)
group by tweetid, tagfilter;
CREATE STREAM FROM TABLE & ENRICHED
STREAM FROM STREAM
create stream top3_likes as
select tweetid, tagfilter, topk( likecount, 3)
from like_counts
group by tagfilter;
create stream enriched_top3_likes as
select tl.tagfilter, tl.tweetid, t.text, t.rowtime
from top3_likes tl
left join tweets t
on tl.tweetid = t.tweetid;
RUNNING TOP 3 OF
BEST LIKED TWEETS PER CONFERENCE
Server Sent
Event
Tweets on #devoxxUK
#java #oraclecode
Tweets
Topic
Oracle Cloud
Event HubApplication
Container
Tweets
Topic
TWEET_COUNT
Topic
Running Tweets
Aggregation
Tweet-Like
Topic
Running Top3 Like
Counts Aggregation
Tweet_Like_
Counts
Topic
Client
Client
Client
Client
IoT metrics from
hundreds of devices
User actions & click
events from webshop
Live Traffic EventsMicroservices chatter
Social Media events
(Facebook,
Whatsapp, …)
IT Operations –
monitoring metrics
µ
µ
µ
µ
CONCLUSION
• Fast data – Active UI & Active API leveraging live data streams
• Proactively informing consumers with [results from streaming analysis of] events
• Decoupled processing
• Unentangled, separated in space and time
• Distributed across clouds and on premises
• Kafka
• Scalable, reliable, historic Events & Data Store
• Streaming Analysis –Kafka Streams and KSQL
• Modern browser – push capability & bi-directional communication
• SSE, WebSocket, HTTP/2, WebWorker Notifications
• Active UI with happy users, fresh data without burden on back end systems
• “Step away from that F5 key”
• Blog: technology.amis.nl
• Email: lucas.jellema@amis.nl
• : lucasjellema
• : lucas-jellema
• : www.amis.nl, info@amis.nl
+31 306016000
Edisonbaan 15,
Nieuwegein
https://github.com/lucasjellema/devoxxUK18-active-ui-streaming-analysis

More Related Content

PDF
Apache Kafka Architecture & Fundamentals Explained
PPTX
Elastic stack Presentation
PPTX
Elastic Stack Introduction
PDF
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
PPTX
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
PDF
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
PDF
Can Apache Kafka Replace a Database?
PDF
Making Data Timelier and More Reliable with Lakehouse Technology
Apache Kafka Architecture & Fundamentals Explained
Elastic stack Presentation
Elastic Stack Introduction
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Trino: A Ludicrously Fast Query Engine - Pulsar Summit NA 2021
Can Apache Kafka Replace a Database?
Making Data Timelier and More Reliable with Lakehouse Technology

What's hot (20)

PPTX
An Introduction To REST API
PDF
Clean architectures with fast api pycones
PDF
Kafka streams windowing behind the curtain
PDF
Running Apache NiFi with Apache Spark : Integration Options
PDF
Introduction to Kong API Gateway
PDF
Apache Druid 101
KEY
Web API Basics
PPTX
Kafka presentation
PDF
Kafka Streams State Stores Being Persistent
PDF
Stream Processing with Apache Kafka and .NET
PDF
Introduction to Kafka Streams
PPT
Graphql presentation
PDF
When NOT to use Apache Kafka?
PPTX
REST API Design & Development
PDF
Scaling your Data Pipelines with Apache Spark on Kubernetes
PDF
Massive Data Processing in Adobe Using Delta Lake
PDF
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
PPTX
PDF
Introduction to elasticsearch
PPTX
Mongo DB Presentation
An Introduction To REST API
Clean architectures with fast api pycones
Kafka streams windowing behind the curtain
Running Apache NiFi with Apache Spark : Integration Options
Introduction to Kong API Gateway
Apache Druid 101
Web API Basics
Kafka presentation
Kafka Streams State Stores Being Persistent
Stream Processing with Apache Kafka and .NET
Introduction to Kafka Streams
Graphql presentation
When NOT to use Apache Kafka?
REST API Design & Development
Scaling your Data Pipelines with Apache Spark on Kubernetes
Massive Data Processing in Adobe Using Delta Lake
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Introduction to elasticsearch
Mongo DB Presentation
Ad

Similar to Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push (20)

PPTX
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
PPTX
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
PDF
Build real time stream processing applications using Apache Kafka
PDF
Streaming Solutions for Real time problems
PPTX
Building streaming data applications using Kafka*[Connect + Core + Streams] b...
PDF
How to Build Streaming Apps with Confluent II
PPTX
Apache kafka
PPTX
Kafka Streams for Java enthusiasts
PDF
Connect K of SMACK:pykafka, kafka-python or?
PPT
Kafka Explainaton
PDF
Building Streaming Data Applications Using Apache Kafka
PDF
Kafka and Storm - event processing in realtime
PDF
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
PDF
Rethinking Stream Processing with Apache Kafka: Applications vs. Clusters, St...
PDF
Kafka Connect and Streams (Concepts, Architecture, Features)
PPTX
Introduction to Kafka Streams Presentation
PPTX
Distributed messaging through Kafka
PPTX
Apache Kafka with Spark Streaming: Real-time Analytics Redefined
PDF
Streaming solutions for real time problems
PPTX
Building Event-Driven Systems with Apache Kafka
What is Kafka & why is it Important? (UKOUG Tech17, Birmingham, UK - December...
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
Build real time stream processing applications using Apache Kafka
Streaming Solutions for Real time problems
Building streaming data applications using Kafka*[Connect + Core + Streams] b...
How to Build Streaming Apps with Confluent II
Apache kafka
Kafka Streams for Java enthusiasts
Connect K of SMACK:pykafka, kafka-python or?
Kafka Explainaton
Building Streaming Data Applications Using Apache Kafka
Kafka and Storm - event processing in realtime
JAZOON'13 - Guide Schmutz - Kafka and Strom Event Processing In Realtime
Rethinking Stream Processing with Apache Kafka: Applications vs. Clusters, St...
Kafka Connect and Streams (Concepts, Architecture, Features)
Introduction to Kafka Streams Presentation
Distributed messaging through Kafka
Apache Kafka with Spark Streaming: Real-time Analytics Redefined
Streaming solutions for real time problems
Building Event-Driven Systems with Apache Kafka
Ad

More from Lucas Jellema (20)

PPTX
Introduction to web application development with Vue (for absolute beginners)...
PPTX
Making the Shift Left - Bringing Ops to Dev before bringing applications to p...
PPTX
Lightweight coding in powerful Cloud Development Environments (DigitalXchange...
PPTX
Apache Superset - open source data exploration and visualization (Conclusion ...
PPTX
CONNECTING THE REAL WORLD TO ENTERPRISE IT – HOW IoT DRIVES OUR ENERGY TRANSI...
PPTX
Help me move away from Oracle - or not?! (Oracle Community Tour EMEA - LVOUG...
PPTX
Op je vingers tellen... tot 1000!
PPTX
IoT - from prototype to enterprise platform (DigitalXchange 2022)
PPTX
Who Wants to Become an IT Architect-A Look at the Bigger Picture - DigitalXch...
PPTX
Steampipe - use SQL to retrieve data from cloud, platforms and files (Code Ca...
PPTX
Automation of Software Engineering with OCI DevOps Build and Deployment Pipel...
PPTX
Introducing Dapr.io - the open source personal assistant to microservices and...
PPTX
How and Why you can and should Participate in Open Source Projects (AMIS, Sof...
PPTX
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
PPTX
Microservices, Node, Dapr and more - Part One (Fontys Hogeschool, Spring 2022)
PPTX
6Reinventing Oracle Systems in a Cloudy World (RMOUG Trainingdays, February 2...
PPTX
Help me move away from Oracle! (RMOUG Training Days 2022, February 2022)
PPTX
Tech Talks 101 - DevOps (jan 2022)
PPTX
Conclusion Code Cafe - Microcks for Mocking and Testing Async APIs (January 2...
PPTX
Cloud Native Application Development - build fast, low TCO, scalable & agile ...
Introduction to web application development with Vue (for absolute beginners)...
Making the Shift Left - Bringing Ops to Dev before bringing applications to p...
Lightweight coding in powerful Cloud Development Environments (DigitalXchange...
Apache Superset - open source data exploration and visualization (Conclusion ...
CONNECTING THE REAL WORLD TO ENTERPRISE IT – HOW IoT DRIVES OUR ENERGY TRANSI...
Help me move away from Oracle - or not?! (Oracle Community Tour EMEA - LVOUG...
Op je vingers tellen... tot 1000!
IoT - from prototype to enterprise platform (DigitalXchange 2022)
Who Wants to Become an IT Architect-A Look at the Bigger Picture - DigitalXch...
Steampipe - use SQL to retrieve data from cloud, platforms and files (Code Ca...
Automation of Software Engineering with OCI DevOps Build and Deployment Pipel...
Introducing Dapr.io - the open source personal assistant to microservices and...
How and Why you can and should Participate in Open Source Projects (AMIS, Sof...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Node, Dapr and more - Part One (Fontys Hogeschool, Spring 2022)
6Reinventing Oracle Systems in a Cloudy World (RMOUG Trainingdays, February 2...
Help me move away from Oracle! (RMOUG Training Days 2022, February 2022)
Tech Talks 101 - DevOps (jan 2022)
Conclusion Code Cafe - Microcks for Mocking and Testing Async APIs (January 2...
Cloud Native Application Development - build fast, low TCO, scalable & agile ...

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
System and Network Administraation Chapter 3
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Nekopoi APK 2025 free lastest update
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
L1 - Introduction to python Backend.pptx
PPTX
history of c programming in notes for students .pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Upgrade and Innovation Strategies for SAP ERP Customers
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Softaken Excel to vCard Converter Software.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
System and Network Administraation Chapter 3
Design an Analysis of Algorithms I-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Nekopoi APK 2025 free lastest update
VVF-Customer-Presentation2025-Ver1.9.pptx
L1 - Introduction to python Backend.pptx
history of c programming in notes for students .pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
Operating system designcfffgfgggggggvggggggggg
PTS Company Brochure 2025 (1).pdf.......
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)

Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push

  • 1. #ActiveUIDevoxxUK @lucasjellema Real Time UI with Apache Kafka Streaming Analytics of Fast Data and Server Push Lucas Jellema (CTO AMIS) @lucasjellema http://technology.amis.nl www.amis.nl
  • 8. FAST DATA AND ACTIVE UI • Handle [data | event] influx • Analyze in real time • Publish findings instantaneously • Update UI & notify end user immediately • Convince end user that the UI is (still) active (and no F5 is required) • Decoupled components • No data loss when a component is temporarily down • Scalable with volume of events and of number of clients
  • 10. THE CASE AT HAND Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for tags Show live tweet aggregates per tag Allow users to like tweets – and show live list of liked tweets Show a live list of top 3 liked tweets per tag Standin for all Hot Sources of Live Data: IoT Physical World Reports, IT Ops, Web Click Statistics, Business Process execution, open data feeds (traffic, weather, stocks, …), Points of Sales, Social Media, microservices chatter
  • 12. FOLLOWING ALONG (AND HELP WITH) THE DEMO http://bit.ly/ActiveUIDevoxxUK
  • 14. INTRODUCING APACHE KAFKA • ..- 2010 – creation at Linkedin • Message Bus | Event Broker | Streaming Data Platform • High volume, low latency, highly reliable, cross technology Commit Log (ledger) • Scalable (#messages & #consumers), distributed, durable, strict message ordering, …. • 2011/2012 – open source under the Apache Incubator/ Top Project • Backed by Confluent – Confluent Open Source & Confluent Enterprise • Kafka is used by most many [large] corporations: • And embraced by [almost] all many software vendors & cloud providers • Client libraries available for NodeJS, Java, C/C++, Python, Ruby, PHP, Scala, Clojure, Rust, .NET, go (aka golang) and many more • Apache Kafka includes Connect, Mirror Maker, Streams • KSQL is Open Source, part of the Confluent Platform
  • 16. KAFKA TERMINOLOGY • Topic • partition • Message • == ByteArray • Broker • replicated • Producer • Consumer • Working together in Consumer Groups Producer Consumer Topic Broker Key Value Time Message
  • 18. THE CASE AT HAND – STEP ONE Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag in each client Tweets Topic
  • 19. THE CASE AT HAND – STEP ONE AND A HALF Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag in each client Tweets Topic
  • 20. THE CASE AT HAND – STEP ONE AND TWO Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic Oracle Cloud Event HubApplication Container
  • 24. KAFKA CONSUMER IN NODE GETS EVENTS PUSHED INTO APPLICATION
  • 25. WEB APP REGISTERS LISTENER WITH KAFKA EVENT CONSUMER
  • 26. THE CASE AT HAND SERVER SENT EVENTS FOR PUSH BACK Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic Server Sent Event
  • 27. SERVER SENT EVENT – SERVER SIDE
  • 28. SERVER SENT EVENT – CLIENT SIDE
  • 30. THE CASE AT HAND TWEET LIKES – CLIENT TO SERVER TO ALL CLIENTS Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic SSE Allow users to like tweets – and show live list of liked tweets
  • 31. THE CASE AT HAND WEB SOCKETS – FOR BI DIRECTIONAL PUSH Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic SSE WebSockets Allow users to like tweets – and show live list of liked tweets
  • 33. WEBSOCKETS – CLIENT SIDE - PUBLISHING Client WebSockets
  • 34. WEBSOCKETS – CLIENT SIDE - CONSUMING Client WebSockets
  • 36. THE CASE AT HAND: RUNNING COUNT STREAMING ANALYSIS OF TWEET EVENTS Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic SSE WebSockets Allow users to like tweets – and show live list of liked tweets Show live tweet aggregates per tag
  • 37. THE CASE AT HAND - STREAMING ANALYSIS OF TWEETS Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic WebSockets Allow users to like tweets – and show live list of liked tweets Show live tweet aggregates per tag tweetAnalytics Topic Streaming Tweets Aggregation µ SSE
  • 38. KAFKA STREAMS • Real Time Event [Stream] Processing integrated into Kafka • Aggregations & Top-N • Time Windows • Continuous Queries • Latest State (event sourcing) • Turn Stream (of changes) into Table (of most recent or current state) • Part of the state can be quite old • Exactly-once processing in Kafka Streams (as of 0.11.0) • Note: Kafka Streams is relatively new • Only support for Java clients; Scala client is planned too
  • 40. EXAMPLE OF KAFKA STREAMS Topic groupBy Aggregate Join Topic Map (Xform) Publish TweetMessage Tag Text Author Set Conference as key Sum/Avg/Top3 by key (==tagFilter) As JSON Round aggregate to nearest 100 e.g. Author Details Topic: CountTweetsPerTag and possibly per time window
  • 41. ADD KAFKA STREAMS CAPABILITIES TO ANY JAVA APPLICATION • Add Maven Dependency • Connect to Kafka Cluster • Compose & Execute Kafka Streams logic: • Write Java code
  • 42. KAFKA STREAMS – RUNNING COUNT TWEETS PER CONFERENCE
  • 43. WOULDN’T IT BE NICE IF YOU COULD JUST DO select tagfilter , count(*) as tag_cnt from tweets window hopping ( size 5 minutes , advance by 30 seconds) group by tagfilter
  • 44. KSQL – CONTINUOUS QUERIES – PROCESSING EVENT STREAMS LIKE TABLES • Transform, Filter, Join, Aggregate, (time) Window on Event Streams • Results are produced as regular Kafka Events
  • 45. RUNNING TWEET COUNT THROUGH KSQL
  • 46. RUNNING TWEET COUNT THROUGH KSQL • KSQL CLI • List topics • Print topic • Create stream • Create table • List Topics • Query from table
  • 47. RUNNING TWEET COUNT THROUGH KSQL
  • 48. KSQL RUNNING COUNT OF TWEETS PER TAG RESULTS PUBLISHED ON KAFKA TOPIC Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic Allow users to like tweets – and show live list of liked tweets Show live tweet aggregates per conference TWEET_COUNT Topic Running Tweets Aggregation SSE Show a live list of top 3 liked tweets per tag
  • 49. STREAMING TWEET ANALYTICS - PUSHED TO CLIENT Server Sent Event
  • 50. KSQL INTERFACES Kafka Cluster Kafka Streams API KSQL Server HTTP REST API CLI JDBC Driver KTable KStream Topic Topic Topic KTable Topic Topic Java Application KStream
  • 51. THE THREE FLAVORS OF STREAM[ING] ANALYTICS WITH KAFKA Kafka Cluster KTable KStream Topic Topic Topic KTable Topic Topic KStream
  • 52. THE CASE AT HAND – STREAMING ANALYSIS OF TWEET LIKES Client Client Client Client Tweets on #devoxxUK #java #oraclecode Show live tweet feed for each tag Tweets Topic WebSockets Allow users to like tweets – and show live list of liked tweets Show live tweet aggregates per conference TWEET_COUNT Topic Running Tweets Aggregation SSE Show a live list of top 3 liked tweets per tag
  • 53. THE CASE AT HAND - STREAMING ANALYSIS OF TWEET LIKES Client Client Client Client Tweets on #devoxxUK #java #oraclecode Tweets Topic WebSockets TWEET_COUNT Topic Running Tweets Aggregation SSE Show a live list of top 3 liked tweets per tag Tweet-Like Topic Running Top3 Like Counts Aggregation Tweet_Like_ Counts Topic
  • 54. WEBSOCKETS – SERVER SIDE PRODUCE TWEET LIKE EVENTS
  • 55. CREATE STREAM FROM TOPIC & TABLE FROM STREAM create stream tweet_likes ( tweetid varchar) with (kafka_topic='tweet-like_topic' , value_format='json', key='tweetid'); create table like_counts as select count(*) likecount , tweetid , tagfilter from tweet_likes window hopping ( size 60 seconds , advance 10 seconds) group by tweetid, tagfilter;
  • 56. CREATE STREAM FROM TABLE & ENRICHED STREAM FROM STREAM create stream top3_likes as select tweetid, tagfilter, topk( likecount, 3) from like_counts group by tagfilter; create stream enriched_top3_likes as select tl.tagfilter, tl.tweetid, t.text, t.rowtime from top3_likes tl left join tweets t on tl.tweetid = t.tweetid;
  • 57. RUNNING TOP 3 OF BEST LIKED TWEETS PER CONFERENCE Server Sent Event
  • 58. Tweets on #devoxxUK #java #oraclecode Tweets Topic Oracle Cloud Event HubApplication Container Tweets Topic TWEET_COUNT Topic Running Tweets Aggregation Tweet-Like Topic Running Top3 Like Counts Aggregation Tweet_Like_ Counts Topic Client Client Client Client IoT metrics from hundreds of devices User actions & click events from webshop Live Traffic EventsMicroservices chatter Social Media events (Facebook, Whatsapp, …) IT Operations – monitoring metrics µ µ µ µ
  • 59. CONCLUSION • Fast data – Active UI & Active API leveraging live data streams • Proactively informing consumers with [results from streaming analysis of] events • Decoupled processing • Unentangled, separated in space and time • Distributed across clouds and on premises • Kafka • Scalable, reliable, historic Events & Data Store • Streaming Analysis –Kafka Streams and KSQL • Modern browser – push capability & bi-directional communication • SSE, WebSocket, HTTP/2, WebWorker Notifications • Active UI with happy users, fresh data without burden on back end systems • “Step away from that F5 key”
  • 60. • Blog: technology.amis.nl • Email: lucas.jellema@amis.nl • : lucasjellema • : lucas-jellema • : www.amis.nl, info@amis.nl +31 306016000 Edisonbaan 15, Nieuwegein https://github.com/lucasjellema/devoxxUK18-active-ui-streaming-analysis

Editor's Notes

  • #16: https://cwiki.apache.org/confluence/display/KAFKA/Clients