SlideShare a Scribd company logo
1 of 33
Download to read offline
MESSAGE	
BROKER
BY:	HALUAN	MOHAMMAD	IRSAD
What	is	MB?
Message	broker	is	a	middleware	to	exchange	message	in	
telecommunication	or	computer	networks.
When	to	use	MB?
1. Decoupling	message	publisher	and	consumer	(receiver)
2. Storing	the	message
3. Routing	of	message
4. Monitoring	and	management	of	messages
How	MB	works?
• Queuing
• Publish-Subscribe
Queuing
“ A	pool	of	consumers	may	read	from	a	server	and	each	record	goes	to	
one	of	them”
(+)	Allow	to	divide	up	the	data	processing	over	multiple	consumer	
instances,	which	lets	you	scale	up	the	process.
(-)	Not	multi-subscriber—once	one	process	reads	the	data	it's	gone.
Publish-Subscribe
“Broadcast	messages	to	all	consumers	that	subscribed	to	a	specific	
channel”
(+)	Allow	greater	scalability	and	a	more	dynamic	network	topology.
(-)	Message	specification	and	participant	rules	adds	some	more	
complexity	to	the	system.
(-)	Has	no	way	of	scaling	processing	since	every	message	goes	to	every	
subscriber
MB	Tools?
• RabbitMQ
• ActiveMQ
• Apache	Kafka
Throughput	Benchmark
Throughput	Benchmark	(Batch)
Notes	not	to	Use	Message	Broker	(MB)
Measure	System	Couple
• Loose	Coupling:	don’t	use MB
• Tight	Coupling:	use MB
Notes	not	to	Use	MB
The	system	already	implement	
Observer	Design	Pattern	
(read	more:	
https://sourcemaking.com/design_patt
erns/observer)
APACHE	KAFKA
Kafka	is	awesome	(ehemmm..)
• Building	real-time	streaming	data	pipelines	that	reliably	get	data	
between	systems	or	applications
• Building	real-time	streaming	applications	that	transform	or	react	to	
the	streams	of	data
Waittt,	STREAM????
Stream	is	the	way	data	transfer as	piece by	piece data	rather than	as	a	
whole.
Concepts
• Kafka	is	run	as	a	cluster	on	one	or	more	servers.
• The	Kafka	cluster	stores streams	of records in	categories	called topics.
• Each	record	consists	of	a	key,	a	value,	and	a	timestamp
Core	APIs
• The Producer	API allows	an	application	to	publish a	stream	records	to	one	
or	more	Kafka	topics.
• The Consumer	API allows	an	application	to	subscribe to	one	or	more	topics	
and	process	the	stream	of	records	produced	to	them.
• The Streams	API allows	an	application	to	act	as	a stream	processor,	
consuming an	input	stream	from	one	or	more	topics	and	producing an	
output	stream	to	one	or	more	output	topics,	effectively	transforming	the	
input	streams	to	output	streams.
• The Connector	API allows	building	and	running	reusable	producers or	
consumers that	connect Kafka	topics	to	existing	applications	or	data	
systems.	For	example,	a	connector	to	a	relational	database	might	capture	
every	change	to	a	table.
Kafka	Topic
A	topic is	a	category or	feed	name	to	which	records are	published.	
Topics in	Kafka	are	always	multi-subscriber;	that	is,	a	topic	can	have	
zero,	one,	or	many	consumers	that	subscribe	to	the	data	written	to	it.
Kafka	Partition
For	each	topic,	the	Kafka	cluster	maintains a	partitioned log.
Kafka	Logs
Each	partition is	an	ordered,	immutable sequence	of	records	that	is	
continually	appended	to—a	structured	commit	log.
Distribution
• Each	partition	has	one	server	which	acts	as	the	"leader"	and	zero	or	
more	servers	which	act	as	"followers".	The	leader	handles	all	read	
and	write	requests	for	the	partition	while	the	followers passively	
replicate the	leader
• Use	ZooKeeper (more	next	part)
Producers	&	Consumers
Guarantees
• Messages	sent	by	a	producer	to	a	particular	topic	partition	will	be	
appended	in	the	order	they	are	sent.	That	is,	if	a	record	M1	is	sent	by	
the	same	producer	as	a	record	M2,	and	M1	is	sent	first,	then	M1	will	
have	a	lower	offset	than	M2	and	appear	earlier	in	the	log	(FIFO).
• A	consumer	instance	sees	records	in	the	order	they	are	stored	in	the	
log.
• For	a	topic	with	replication	factor	N,	Kafka	will	tolerate	up	to	N-1	
server	failures without	losing any	records	committed	to	the	log.
Kafka	as	a	Storage	System
• Data	written to	Kafka	is	written	to	disk and	replicated for	fault-
tolerance.	
• Kafka	allows	producers	to	wait	on	acknowledgement	so	that	a	write	
isn't	considered	complete	until	it	is	fully	replicated	and	guaranteed to	
persist	even	if	the	server	written	to	fails.
Kafka	for	Stream	Processing
• Handling	out-of-order	data,	reprocessing input	as	code	changes,	
performing	stateful computations	in	real	time.
(Read	more	https://kafka.apache.org/documentation.html#streams)
ZOOKEEPER
ZooKeeper
A	tools	to	help	control	and	monitoring	distributed	systems.
How	it	works?
• ZooKeeper Managed	Kafka	cluster	configuration.
• ZooKeeper can	elect	Kafka	node	to	become	the	master.
• Producers	and	Consumers	are	notified	by	ZooKeeper service	about	
the	presence	of	new broker	in	Kafka	system	or	failure of	the	broker	in	
the	Kafka	system.
• ZooKeeper Synchronized	Kafka	across	the	cluster.
Single	Node	for	Multiple	Broker	Cluster
Multiple	Node	for	Multiple	Broker	Cluster
Notes
• Kafka	topic	replication	handled by	Kafka
Putting	the	Pieces	Together	(DO)
• Write	a	Scala	service	as	the	producer
• Write	a	ruby	service	as	the	consumer
• Exchange	data	in	real	time
Kafka as Message Broker

More Related Content

What's hot

Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Lucas Jellema
 

What's hot (20)

Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...Building a Streaming Microservice Architecture: with Apache Spark Structured ...
Building a Streaming Microservice Architecture: with Apache Spark Structured ...
 
Event-Driven Messaging and Actions using Apache Flink and Apache NiFi
Event-Driven Messaging and Actions using Apache Flink and Apache NiFiEvent-Driven Messaging and Actions using Apache Flink and Apache NiFi
Event-Driven Messaging and Actions using Apache Flink and Apache NiFi
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin Podval
 
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
Microservices, Apache Kafka, Node, Dapr and more - Part Two (Fontys Hogeschoo...
 
Apache Kafka at LinkedIn
Apache Kafka at LinkedInApache Kafka at LinkedIn
Apache Kafka at LinkedIn
 
Kafka basics
Kafka basicsKafka basics
Kafka basics
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Running Apache NiFi with Apache Spark : Integration Options
Running Apache NiFi with Apache Spark : Integration OptionsRunning Apache NiFi with Apache Spark : Integration Options
Running Apache NiFi with Apache Spark : Integration Options
 
Event-driven architecture
Event-driven architectureEvent-driven architecture
Event-driven architecture
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
Slide #1:Introduction to Apache Storm
Slide #1:Introduction to Apache StormSlide #1:Introduction to Apache Storm
Slide #1:Introduction to Apache Storm
 
Prometheus Overview
Prometheus OverviewPrometheus Overview
Prometheus Overview
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache Kafka
 
Introduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperIntroduction to Kafka and Zookeeper
Introduction to Kafka and Zookeeper
 
Best Practices for Streaming IoT Data with MQTT and Apache Kafka®
Best Practices for Streaming IoT Data with MQTT and Apache Kafka®Best Practices for Streaming IoT Data with MQTT and Apache Kafka®
Best Practices for Streaming IoT Data with MQTT and Apache Kafka®
 
Composable Software Architecture with Spring
Composable Software Architecture with SpringComposable Software Architecture with Spring
Composable Software Architecture with Spring
 
kafka
kafkakafka
kafka
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database System
 

Viewers also liked

Building Kafka-powered Activity Stream
Building Kafka-powered Activity StreamBuilding Kafka-powered Activity Stream
Building Kafka-powered Activity Stream
Oleksiy Holubyev
 

Viewers also liked (20)

Algorithm Analyzing
Algorithm AnalyzingAlgorithm Analyzing
Algorithm Analyzing
 
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
Reactive Fast Data & the Data Lake with Akka, Kafka, SparkReactive Fast Data & the Data Lake with Akka, Kafka, Spark
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
 
Introduction to Big Data
Introduction to Big DataIntroduction to Big Data
Introduction to Big Data
 
Kick-Start with SMACK Stack
Kick-Start with SMACK StackKick-Start with SMACK Stack
Kick-Start with SMACK Stack
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Building Kafka-powered Activity Stream
Building Kafka-powered Activity StreamBuilding Kafka-powered Activity Stream
Building Kafka-powered Activity Stream
 
Apache Kafka 0.8 basic training - Verisign
Apache Kafka 0.8 basic training - VerisignApache Kafka 0.8 basic training - Verisign
Apache Kafka 0.8 basic training - Verisign
 
Something about Kafka - Why Kafka is so fast
Something about Kafka - Why Kafka is so fastSomething about Kafka - Why Kafka is so fast
Something about Kafka - Why Kafka is so fast
 
Geek Talk Backend Unit Testing in Go Language
Geek Talk Backend Unit Testing in Go LanguageGeek Talk Backend Unit Testing in Go Language
Geek Talk Backend Unit Testing in Go Language
 
ирисметова ф.
ирисметова ф.ирисметова ф.
ирисметова ф.
 
IBM MQ Disaster Recovery
IBM MQ Disaster RecoveryIBM MQ Disaster Recovery
IBM MQ Disaster Recovery
 
Apache Kafka: A high-throughput distributed messaging system @ JCConf 2014
Apache Kafka: A high-throughput distributed messaging system @ JCConf 2014Apache Kafka: A high-throughput distributed messaging system @ JCConf 2014
Apache Kafka: A high-throughput distributed messaging system @ JCConf 2014
 
Developing real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and KafkaDeveloping real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and Kafka
 
IBM MQ V9 Overview
IBM MQ V9 OverviewIBM MQ V9 Overview
IBM MQ V9 Overview
 
WebSphere Message Broker Application Development Training
WebSphere Message Broker Application Development TrainingWebSphere Message Broker Application Development Training
WebSphere Message Broker Application Development Training
 
Apex & Geode: In-memory streaming, storage & analytics
Apex & Geode: In-memory streaming, storage & analyticsApex & Geode: In-memory streaming, storage & analytics
Apex & Geode: In-memory streaming, storage & analytics
 
唯品会大数据实践 Sacc pub
唯品会大数据实践 Sacc pub唯品会大数据实践 Sacc pub
唯品会大数据实践 Sacc pub
 
Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafka
 
Streaming all the things with akka streams
Streaming all the things with akka streams   Streaming all the things with akka streams
Streaming all the things with akka streams
 
What's new in Confluent 3.2 and Apache Kafka 0.10.2
What's new in Confluent 3.2 and Apache Kafka 0.10.2 What's new in Confluent 3.2 and Apache Kafka 0.10.2
What's new in Confluent 3.2 and Apache Kafka 0.10.2
 

Similar to Kafka as Message Broker

Designing Distributed Systems
Designing Distributed SystemsDesigning Distributed Systems
Designing Distributed Systems
Dhananjay Singh
 
1. Overview of Distributed Systems
1. Overview of Distributed Systems1. Overview of Distributed Systems
1. Overview of Distributed Systems
Daminda Herath
 

Similar to Kafka as Message Broker (20)

Enterprise messaging with jms
Enterprise messaging with jmsEnterprise messaging with jms
Enterprise messaging with jms
 
Designing Distributed Systems
Designing Distributed SystemsDesigning Distributed Systems
Designing Distributed Systems
 
Apache kafka- Onkar Kadam
Apache kafka- Onkar KadamApache kafka- Onkar Kadam
Apache kafka- Onkar Kadam
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues
 
RabbitMq
RabbitMqRabbitMq
RabbitMq
 
ActiveMQ interview Questions and Answers
ActiveMQ interview Questions and AnswersActiveMQ interview Questions and Answers
ActiveMQ interview Questions and Answers
 
MQTT Introduction
MQTT IntroductionMQTT Introduction
MQTT Introduction
 
SNMP/SMTP/MIME
SNMP/SMTP/MIMESNMP/SMTP/MIME
SNMP/SMTP/MIME
 
Application Layer Protocols for the IoT
Application Layer Protocols for the IoTApplication Layer Protocols for the IoT
Application Layer Protocols for the IoT
 
Azure Messaging Services #1
Azure Messaging Services #1Azure Messaging Services #1
Azure Messaging Services #1
 
Mqtt
MqttMqtt
Mqtt
 
WSO2 Message Broker - Product Overview
WSO2 Message Broker - Product OverviewWSO2 Message Broker - Product Overview
WSO2 Message Broker - Product Overview
 
Kafka 10000 feet view
Kafka 10000 feet viewKafka 10000 feet view
Kafka 10000 feet view
 
MQTT Protocol: IOT Technology
MQTT Protocol: IOT TechnologyMQTT Protocol: IOT Technology
MQTT Protocol: IOT Technology
 
1. Overview of Distributed Systems
1. Overview of Distributed Systems1. Overview of Distributed Systems
1. Overview of Distributed Systems
 
Message Oriented Middleware
Message Oriented MiddlewareMessage Oriented Middleware
Message Oriented Middleware
 
Kafka Overview
Kafka OverviewKafka Overview
Kafka Overview
 
ISUG SSB Lior King
ISUG SSB Lior KingISUG SSB Lior King
ISUG SSB Lior King
 
Distributed messaging with Apache Kafka
Distributed messaging with Apache KafkaDistributed messaging with Apache Kafka
Distributed messaging with Apache Kafka
 
Mq Lecture
Mq LectureMq Lecture
Mq Lecture
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 

Kafka as Message Broker