Producing to Kafka - No Key
Time
Partition 1
Partition 2
Partition 3
Partition 4
Messages will be batched and randomly distributed across the partitions
@rmoff
Slide 30
Producing to Kafka - With Key
Time
Partition 1
A
Partition 2
B hash(key) % numPartitions = N
Partition 3
C
Partition 4
D @rmoff
Slide 31
Producers
• A client application • Puts messages into topics • Handles partitioning, network protocol • Java, Go, .NET, C/C++, Python • Also every other language Plus REST proxy if not @rmoff
Slide 32
PUB / SUB @rmoff
Slide 33
Consuming data - access is only sequential
Read to offset & scan Old
New
@rmoff
Slide 34
Consumers have a position of their own
Old
Victoria is here
New
Scan
@rmoff
Slide 35
Consumers have a position of their own
Old
Victoria is here
New
Scan
Tim is here
Scan
@rmoff
Slide 36
Consumers have a position of their own
Rick is here
Scan
Old
Victoria is here
New
Scan
Tim is here
Scan
@rmoff
Slide 37
c, _ := kafka.NewConsumer(&cm) defer c.Close() c.Subscribe(topic, nil) for { select { case ev := <-c.Events(): switch ev.(type) { case *kafka.Message: km := ev.(*kafka.Message) fmt.Printf(“✅ Message ‘%v’ received from topic ‘%v’\n”, string(km.Value), string(*km.TopicPartition.Topic)) } } }
Slide 38
Consuming From Kafka - Single Consumer Partition 1
App1
Partition 2
Partition 3
Partition 4
@rmoff
Stream Processing with ksqlDB Stream:
widgets
ksqlDB
CREATE STREAM widgets_red AS SELECT * FROM widgets WHERE colour=’RED’; Stream:
widgets_red
@rmoff
Slide 78
{
@rmoff
Slide 79
FROM WIDGETS WHERE WEIGHT_G > 120
{
SELECT COUNT(*) FROM WIDGETS GROUP BY PRODUCTION_LINE SELECT AVG(TEMP_CELCIUS) AS TEMP FROM WIDGETS GROUP BY SENSOR_ID HAVING TEMP>20 ‘connector.class’ = ‘S3Connector’, ‘topics’ = ‘widgets’ …);
Slide 80
ksqlDB or Kafka Streams? @rmoff
Photo by Ramiz Dedaković on Unsplash
Slide 81
Standing on the Shoulders of Streaming Giants ksqlDB Powered by
Ease of use ksqlDB UDFs
Kafka Streams Powered by
Producer, Consumer APIs
Flexibility @rmoff
Slide 82
Summary @rmoff
Slide 83
@rmoff
Slide 84
K V
@rmoff
Slide 85
K V
@rmoff
Slide 86
The Log
@rmoff
Slide 87
Producer
Consumer
The Log
@rmoff
Slide 88
Producer
Consumer
The Log
Connectors
@rmoff
Slide 89
Producer
Consumer
The Log
Connectors
Streaming Engine @rmoff
Slide 90
Apache Kafka Producer
Consumer
The Log
Connectors
Streaming Engine @rmoff
Slide 91
Producer
Security
Schema Registry
Consumer
The Log
Streaming Engine ksqlDB
REST Proxy
Connectors
Confluent Control Center
Slide 92
F2 00 OF RM
Free money! (additional $200 towards your bill 😄 )
Fully Managed Kafka as a Service fl
fl
s e l c i t r a eep-dive
D • • • • •
ka? f a K e ds h c n a e r p T A d s i e lat e R What . s v g min a e per r e t e S K t o n o e Z v E ut o h t i w fka a a K k f n a i K s : e t f ante KRa r a u G & ns o i t c a s n a Tr ge a r o t S & ng Processi tals n e m a d Fun
• • • • •
e c n a m r o f r Kafka Pe a k f a K e v i t ms e t s y S Cloud-na e s ba a t a D g n Streami fka a K e h c a p ls a n Testing A r e t n I s fka’ a K e r o l Exp
• • • • •
Over 10
Apache K afka 101 Kafka Co nnect 10 1 Kafka Str eams 101 ksqlDB 1 01 Inside ks qlDB
hours of • • • •
f ree cou
rses
Spring F ramewo rk and K Building afka Data Pip elines wi Event So th Kafka urcing w ith Kafka Data Me sh 101
Plus: Hands-on Quick Starts and Client Language Guides + Event Streaming Patterns + More
fl
developer.con uent.io