SlideShare a Scribd company logo
Streaming with Spring and
Apache Kafka
Spring Cloud Stream
Apache Kafka
Kafka Streams
About me…
Soby Chacko
Committer - Spring Cloud Stream/Spring Cloud Data Flow
Twitter: @sobychacko
Github: github.com/sobychacko
Spring Cloud Stream
Overview
• General purpose framework for writing event
driven/stream processing micro services
• Destination based bindings on your choice of
middleware
Persistent publish-subscribe
Consumer groups
Partitioning Support
Apache Kafka
• Single Source of Truth for data
• Fault Tolerant
• Based on the ubiquitous log
data structure
• Producer/Consumer/Streams
API
• Transactions
• Exactly once semantics
processing guarantees
Application Core
Spring Boot
Spring Kafka
Spring Integration/Kafka Streams
Spring Cloud Stream
Inputs
Outputs
Spring Cloud Stream Application
Model
Application Core
Spring Cloud Stream Application
Inputs Outputs
Binder
Middleware
Zooming in on the Application
Model
Spring Cloud Stream
Event-Driven microservices framework
Pluggable Binder
Implementations
Opportunities: Same code; Same tests; Drop-in replacement for a variety of Message Brokers
Rabbit MQ Apache Kafka Google PubSub
Amazon Kinesis Azure Event Hubs Solace
Spring Cloud Stream
Application level features
• Message conversions are handled by the framework
• Support for error handling - DLQ
• Auto provisioning of topics (destinations)
• Schema evolution
• Health indicators
• And a whole lot of other convenient features….
Spring Cloud Stream
Programming model
• Java 8 based functional programming model
• Spring Cloud Function support as the foundation
• Reactive programming support using Project
Reactor
• Framework provided annotations based
programming (EnableBinding, StreamListener)
Spring Cloud Stream
application types
• Sources - java.util.function.Supplier
• Sinks - java.util.function.Consumer
• Processors - java.util.function.Function
A simple processor
@SpringBootApplication
…
@Bean
public Function<String, String> toUpperCase() {
return String::toUpperCase;
}
A simple source
@SpringBootApplication
…
@Bean
public Supplier<Long> currentTime() {
return System::currentTimeMillis;
}
A simple sink
@SpringBootApplication
…
@Bean
public Consumer<String> cons() {
return x -> {
System.out.println("Consumer");
};
}
Stream processing with
Spring Cloud Stream and
Kafka Streams
“We call an application data-
intensive if data is its primary
challenge—the quantity of
data, the complexity of data,
or the speed at which it is
changing.”
Kafka Streams
• Client library
• No need for dedicated processing cluster
• All guarantees of Kafka are applicable
• Per record processing
• Stateful stream processing
• And many more features…
Spring Cloud Stream
with Kafka Streams
Spring Boot Application
Kafka Streams binder from Spring
Cloud Stream
Kafka Streams library
Kafka Broker
Spring Kafka
Major types available for
stream processing
• KStream
• KTable
• GlobalKTable
Spring Cloud Stream
provides binding capabilities
for all these three types.
Stream processing concepts
• Stream-Table duality
• Time based windowing
• Joins and Aggregation
• Stateless map and filter like operations on data
Stateful Stream Processing
• Kafka Streams provide built in capabilities for
stateful stream processing
• Default state store - RocksDB
• Spring Cloud Stream touch points for interactive
queries in Kafka Streams
Spring Cloud Stream programming
model for Kafka Streams apps
• Java 8 based functional programming model
• Processors can be written as
java.util.function.Function or
java.util.function.Consumer.
• Multiple input/output binding capabilities
Kafka Streams app as a
function…
@Bean
public Function<KStream<Object, String>, KStream<?, WordCount>> process()
{
return input -> input
.flatMapValues(value ->
Arrays.asList(value.toLowerCase().split("W+")))
.map((key, value) -> new KeyValue<>(value, value))
.groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
.windowedBy(TimeWindows.of(5000))
.count(Materialized.as("foo-WordCounts"))
.toStream()
.map((key, value) -> new KeyValue<>(null, new
WordCount(key.key(), value,
new Date(key.window().start()), new
Date(key.window().end()))));
}
Quick Demo…
Resources
• Code used for the demo
• Samples Repository
• Project page
• Dataflow microsite
• Confluent Blogs on Spring with Kafka:

Part 1 | Part 2 | Part 3 | Part 4
Questions?
Comments?

More Related Content

What's hot (18)

PDF
Thesis writing
Prof Jamaluddin
 
PPTX
Apache Kafka
Saroj Panyasrivanit
 
PPTX
Introduction to Kafka and Event-Driven
Dimosthenis Botsaris
 
PPTX
Spring Boot+Kafka: the New Enterprise Platform
VMware Tanzu
 
PPTX
Society and Social Structure Of Pakistan
Hashir Ali Siddiqui
 
PPT
Initial problem of pakistan
falak nawaz
 
PDF
Distributed applications using Hazelcast
Taras Matyashovsky
 
PDF
When NOT to use Apache Kafka?
Kai Wähner
 
PPTX
Ethnic groups Of Pakistan
Aina Qazi
 
PDF
Fundamentals of Apache Kafka
Chhavi Parasher
 
PPTX
An Introduction to Confluent Cloud: Apache Kafka as a Service
confluent
 
PPTX
Introduction to Microservices Patterns
Dimosthenis Botsaris
 
PDF
Reactive Applications with Apache Pulsar and Spring Boot
VMware Tanzu
 
PDF
Apache Kafka - Martin Podval
Martin Podval
 
DOCX
Water dispute between India and Pakistan
babak danyal
 
PDF
Elasticsearch for Data Analytics
Felipe
 
PPT
BLOGIC. (ISWC 2009 Invited Talk)
Pat Hayes
 
Thesis writing
Prof Jamaluddin
 
Apache Kafka
Saroj Panyasrivanit
 
Introduction to Kafka and Event-Driven
Dimosthenis Botsaris
 
Spring Boot+Kafka: the New Enterprise Platform
VMware Tanzu
 
Society and Social Structure Of Pakistan
Hashir Ali Siddiqui
 
Initial problem of pakistan
falak nawaz
 
Distributed applications using Hazelcast
Taras Matyashovsky
 
When NOT to use Apache Kafka?
Kai Wähner
 
Ethnic groups Of Pakistan
Aina Qazi
 
Fundamentals of Apache Kafka
Chhavi Parasher
 
An Introduction to Confluent Cloud: Apache Kafka as a Service
confluent
 
Introduction to Microservices Patterns
Dimosthenis Botsaris
 
Reactive Applications with Apache Pulsar and Spring Boot
VMware Tanzu
 
Apache Kafka - Martin Podval
Martin Podval
 
Water dispute between India and Pakistan
babak danyal
 
Elasticsearch for Data Analytics
Felipe
 
BLOGIC. (ISWC 2009 Invited Talk)
Pat Hayes
 

Similar to Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko (20)

PDF
Event Streaming with Kafka Streams and Spring Cloud Stream | Soby Chacko, VMware
HostedbyConfluent
 
PPTX
Kafka Summit NYC 2017 - Cloud Native Data Streaming Microservices with Spring...
confluent
 
PDF
Kafka Streams - From the Ground Up to the Cloud
VMware Tanzu
 
PDF
James Watters Kafka Summit NYC 2019 Keynote
James Watters
 
PDF
Stream Processing Live Traffic Data with Kafka Streams
Tim Ysewyn
 
PPTX
Stream Processing Live Traffic Data with Kafka Streams
Tom Van den Bulck
 
PPTX
Streaming Data and Stream Processing with Apache Kafka
confluent
 
PDF
Apache Kafka, and the Rise of Stream Processing
Guozhang Wang
 
PDF
Kafka Streams: the easiest way to start with stream processing
Yaroslav Tkachenko
 
ODP
Stream processing using Kafka
Knoldus Inc.
 
PPTX
Building Event Streaming Microservices with Spring Boot and Apache Kafka | Ja...
HostedbyConfluent
 
PDF
Introduction to Kafka Streams
Guozhang Wang
 
PDF
Kafka Connect and Streams (Concepts, Architecture, Features)
Kai Wähner
 
PDF
SpringOne Tour St. Louis - Cloud Event Driven Architectures with Spring Cloud...
VMware Tanzu
 
PDF
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
Lightbend
 
PDF
Build real time stream processing applications using Apache Kafka
Hotstar
 
PDF
Building a Streaming Platform with Kafka
confluent
 
PPTX
Exactly-once Stream Processing with Kafka Streams
Guozhang Wang
 
PDF
Spring Cloud Stream with Kafka
David Kiss
 
PDF
Connect K of SMACK:pykafka, kafka-python or?
Micron Technology
 
Event Streaming with Kafka Streams and Spring Cloud Stream | Soby Chacko, VMware
HostedbyConfluent
 
Kafka Summit NYC 2017 - Cloud Native Data Streaming Microservices with Spring...
confluent
 
Kafka Streams - From the Ground Up to the Cloud
VMware Tanzu
 
James Watters Kafka Summit NYC 2019 Keynote
James Watters
 
Stream Processing Live Traffic Data with Kafka Streams
Tim Ysewyn
 
Stream Processing Live Traffic Data with Kafka Streams
Tom Van den Bulck
 
Streaming Data and Stream Processing with Apache Kafka
confluent
 
Apache Kafka, and the Rise of Stream Processing
Guozhang Wang
 
Kafka Streams: the easiest way to start with stream processing
Yaroslav Tkachenko
 
Stream processing using Kafka
Knoldus Inc.
 
Building Event Streaming Microservices with Spring Boot and Apache Kafka | Ja...
HostedbyConfluent
 
Introduction to Kafka Streams
Guozhang Wang
 
Kafka Connect and Streams (Concepts, Architecture, Features)
Kai Wähner
 
SpringOne Tour St. Louis - Cloud Event Driven Architectures with Spring Cloud...
VMware Tanzu
 
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
Lightbend
 
Build real time stream processing applications using Apache Kafka
Hotstar
 
Building a Streaming Platform with Kafka
confluent
 
Exactly-once Stream Processing with Kafka Streams
Guozhang Wang
 
Spring Cloud Stream with Kafka
David Kiss
 
Connect K of SMACK:pykafka, kafka-python or?
Micron Technology
 

More from VMware Tanzu (20)

PDF
Spring into AI presented by Dan Vega 5/14
VMware Tanzu
 
PDF
What AI Means For Your Product Strategy And What To Do About It
VMware Tanzu
 
PDF
Make the Right Thing the Obvious Thing at Cardinal Health 2023
VMware Tanzu
 
PPTX
Enhancing DevEx and Simplifying Operations at Scale
VMware Tanzu
 
PDF
Spring Update | July 2023
VMware Tanzu
 
PPTX
Platforms, Platform Engineering, & Platform as a Product
VMware Tanzu
 
PPTX
Building Cloud Ready Apps
VMware Tanzu
 
PDF
Spring Boot 3 And Beyond
VMware Tanzu
 
PDF
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
VMware Tanzu
 
PDF
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
VMware Tanzu
 
PDF
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
VMware Tanzu
 
PPTX
tanzu_developer_connect.pptx
VMware Tanzu
 
PDF
Tanzu Virtual Developer Connect Workshop - French
VMware Tanzu
 
PDF
Tanzu Developer Connect Workshop - English
VMware Tanzu
 
PDF
Virtual Developer Connect Workshop - English
VMware Tanzu
 
PDF
Tanzu Developer Connect - French
VMware Tanzu
 
PDF
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
VMware Tanzu
 
PDF
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
VMware Tanzu
 
PDF
SpringOne Tour: The Influential Software Engineer
VMware Tanzu
 
PDF
SpringOne Tour: Domain-Driven Design: Theory vs Practice
VMware Tanzu
 
Spring into AI presented by Dan Vega 5/14
VMware Tanzu
 
What AI Means For Your Product Strategy And What To Do About It
VMware Tanzu
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
VMware Tanzu
 
Enhancing DevEx and Simplifying Operations at Scale
VMware Tanzu
 
Spring Update | July 2023
VMware Tanzu
 
Platforms, Platform Engineering, & Platform as a Product
VMware Tanzu
 
Building Cloud Ready Apps
VMware Tanzu
 
Spring Boot 3 And Beyond
VMware Tanzu
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
VMware Tanzu
 
tanzu_developer_connect.pptx
VMware Tanzu
 
Tanzu Virtual Developer Connect Workshop - French
VMware Tanzu
 
Tanzu Developer Connect Workshop - English
VMware Tanzu
 
Virtual Developer Connect Workshop - English
VMware Tanzu
 
Tanzu Developer Connect - French
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
VMware Tanzu
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
VMware Tanzu
 
SpringOne Tour: The Influential Software Engineer
VMware Tanzu
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
VMware Tanzu
 

Recently uploaded (20)

PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 

Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko

  • 1. Streaming with Spring and Apache Kafka Spring Cloud Stream Apache Kafka Kafka Streams
  • 2. About me… Soby Chacko Committer - Spring Cloud Stream/Spring Cloud Data Flow Twitter: @sobychacko Github: github.com/sobychacko
  • 3. Spring Cloud Stream Overview • General purpose framework for writing event driven/stream processing micro services • Destination based bindings on your choice of middleware
  • 7. Apache Kafka • Single Source of Truth for data • Fault Tolerant • Based on the ubiquitous log data structure • Producer/Consumer/Streams API • Transactions • Exactly once semantics processing guarantees
  • 8. Application Core Spring Boot Spring Kafka Spring Integration/Kafka Streams Spring Cloud Stream Inputs Outputs Spring Cloud Stream Application Model
  • 9. Application Core Spring Cloud Stream Application Inputs Outputs Binder Middleware Zooming in on the Application Model
  • 10. Spring Cloud Stream Event-Driven microservices framework Pluggable Binder Implementations Opportunities: Same code; Same tests; Drop-in replacement for a variety of Message Brokers Rabbit MQ Apache Kafka Google PubSub Amazon Kinesis Azure Event Hubs Solace
  • 11. Spring Cloud Stream Application level features • Message conversions are handled by the framework • Support for error handling - DLQ • Auto provisioning of topics (destinations) • Schema evolution • Health indicators • And a whole lot of other convenient features….
  • 12. Spring Cloud Stream Programming model • Java 8 based functional programming model • Spring Cloud Function support as the foundation • Reactive programming support using Project Reactor • Framework provided annotations based programming (EnableBinding, StreamListener)
  • 13. Spring Cloud Stream application types • Sources - java.util.function.Supplier • Sinks - java.util.function.Consumer • Processors - java.util.function.Function
  • 14. A simple processor @SpringBootApplication … @Bean public Function<String, String> toUpperCase() { return String::toUpperCase; }
  • 15. A simple source @SpringBootApplication … @Bean public Supplier<Long> currentTime() { return System::currentTimeMillis; }
  • 16. A simple sink @SpringBootApplication … @Bean public Consumer<String> cons() { return x -> { System.out.println("Consumer"); }; }
  • 17. Stream processing with Spring Cloud Stream and Kafka Streams
  • 18. “We call an application data- intensive if data is its primary challenge—the quantity of data, the complexity of data, or the speed at which it is changing.”
  • 19. Kafka Streams • Client library • No need for dedicated processing cluster • All guarantees of Kafka are applicable • Per record processing • Stateful stream processing • And many more features…
  • 20. Spring Cloud Stream with Kafka Streams Spring Boot Application Kafka Streams binder from Spring Cloud Stream Kafka Streams library Kafka Broker Spring Kafka
  • 21. Major types available for stream processing • KStream • KTable • GlobalKTable Spring Cloud Stream provides binding capabilities for all these three types.
  • 22. Stream processing concepts • Stream-Table duality • Time based windowing • Joins and Aggregation • Stateless map and filter like operations on data
  • 23. Stateful Stream Processing • Kafka Streams provide built in capabilities for stateful stream processing • Default state store - RocksDB • Spring Cloud Stream touch points for interactive queries in Kafka Streams
  • 24. Spring Cloud Stream programming model for Kafka Streams apps • Java 8 based functional programming model • Processors can be written as java.util.function.Function or java.util.function.Consumer. • Multiple input/output binding capabilities
  • 25. Kafka Streams app as a function… @Bean public Function<KStream<Object, String>, KStream<?, WordCount>> process() { return input -> input .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("W+"))) .map((key, value) -> new KeyValue<>(value, value)) .groupByKey(Serialized.with(Serdes.String(), Serdes.String())) .windowedBy(TimeWindows.of(5000)) .count(Materialized.as("foo-WordCounts")) .toStream() .map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end())))); }
  • 27. Resources • Code used for the demo • Samples Repository • Project page • Dataflow microsite • Confluent Blogs on Spring with Kafka:
 Part 1 | Part 2 | Part 3 | Part 4