SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
RabbitMQ
3th WEEK
SATURDAY, JULY 06, 2013 – SUNDAY, JULY 07, 2013
GEEK ACADEMY 2013
RABBITMQ
GEEK ACADEMY 2013
MQ History
1985 1993
TIB IBM MQSeries RabbitMQ
2006
A
B
C
D
E
Consumers
Producers
Broker
Exchanges
Queues
F
G
H
I
J
Bindings
Channel
Direct Exchange
Fanout Exchange
Topic Exchange
KEY WORDS
01. EXCHANGES
Exchanges are where producers publish their messages.
02. QUEUES
Queues are where the messages end up and are received by consumers.
03. BINDINDS
Bindings are how the messages get routed from the exchange to
particular queues
AMQP ELEMENTS
CONSUMERS AND PRODUCERS
10
%
100
%
10
%
10%
10
%
10
%
10%
NOT ABOUT
ECONOMICS
AM LP CM KM YH R M HT
Producers create messages and publish (send)
them to a broker server. Then the broker will
determine who(consumers) should get a copy of
messages.
Message = Payload + Label
FLOWS
MessageProducer Exchange
QueueBinding Consumer
"lightweight connections
that share a single TCP
connection".
CHANNELS
What?
DEFAULT EXCHANGE
producer broker consumer
consumer
consumer
geeky2
geeky1
geeky3
Demo
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(RABBITMQ_HOST);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
boolean durable = true;
channel.queueDeclare(queue, durable, false, isAutoDelete, null);
Producer:
o channel.basicPublish( "", queue, null, message.getBytes());
Consumer:
o QueueingConsumer consumer = new QueueingConsumer(channel);
o channel.basicConsume(queue, autoAck, consumer);
o QueueingConsumer.Delivery delivery = consumer.nextDelivery();
o String message = new String(delivery.getBody());
DIRECT EXCHANGE
producer broker
consumer
consumer
geeky.jvm
geeky.groovy
geeky.jvm
geeky.java
Demo
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(RABBITMQ_HOST);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.exchangeDeclare(EXCHANGE_NAME, "direct");
Producer:
o channel.basicPublish( exchangeName, serevity, null, message.getBytes());
Consumer:
o channel.queueBind(queueName, EXCHANGE_NAME, severity);
o QueueingConsumer consumer = new QueueingConsumer(channel);
o channel.basicConsume(queue, autoAck, consumer);
o QueueingConsumer.Delivery delivery = consumer.nextDelivery();
o String message = new String(delivery.getBody());
FANOUT EXCHANGE
producer broker consumer
consumer
consumer
Hello
geeky
Hello
geeky
Hellogeeky
Demo
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(RABBITMQ_HOST);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
Producer:
o channel.basicPublish( EXCHANGE_NAME, "", null, message.getBytes());
Consumer:
o String queueName = channel.queueDeclare().getQueue();
o channel.queueBind(queueName, EXCHANGE_NAME, "");
o QueueingConsumer consumer = new QueueingConsumer(channel);
o channel.basicConsume(queue, isAck, consumer);
o QueueingConsumer.Delivery delivery = consumer.nextDelivery();
o String message = new String(delivery.getBody());
TOPIC EXCHANGE
producer broker consumer
consumer
consumer
geeky.#
*.java.*
*.groovy.*
*.*.spring
Demo
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(RABBITMQ_HOST);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
boolean durable = true;
channel.exchangeDeclare(EXCHANGE_NAME, "topic");
Producer:
o channel.basicPublish( EXCHANGE_NAME, routingKey, null,
message.getBytes());
Consumer:
o String queueName = channel.queueDeclare().getQueue();
o channel.queueBind(queueName, EXCHANGE_NAME, bindingKey);
o QueueingConsumer consumer = new QueueingConsumer(channel);
o channel.basicConsume(queue, isAck, consumer);
o QueueingConsumer.Delivery delivery = consumer.nextDelivery();
o String message = new String(delivery.getBody());
Rabbitmqctl
o rabbitmqctl start
o rabbitmqctl stop
o rabbitmqctl list_queues
o rabbitmqctl list_exchanges
o rabbitmqctl list_bindings
o rabbitmqctl list_users
o rabbitmqctl add_user [username] [password]
o rabbitmqctl delete_user [username]
o rabbitmqctl changepassword [username] [new password]
01. http://www.springsource.org/spring-amqp
03.http://www.rabbitmq.com
04.http://hg.rabbitmq.com/rabbitmq-java-client/
READ MORE...
02.https://github.com/SpringSource/spring-amqp
05.https://github.com/up1/geeky_week3_demo
GEEK ACADEMY 2013
THANK YOU FOR
YOUR TIME
GEEK ACADEMY 2013

Contenu connexe

Similaire à Geeky.week3.rabbitmq

Building scalable network applications with Netty
Building scalable network applications with NettyBuilding scalable network applications with Netty
Building scalable network applications with Netty
NLJUG
 
David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...
David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...
David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...
eCommConf
 
Type-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web ServicesType-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web Services
Jácome Cunha
 
Type-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web ServicesType-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web Services
jacomecunha
 
Project 4 (P4) Distance Vector Routing (DV)Instructor Dr.docx
Project 4 (P4) Distance Vector Routing (DV)Instructor Dr.docxProject 4 (P4) Distance Vector Routing (DV)Instructor Dr.docx
Project 4 (P4) Distance Vector Routing (DV)Instructor Dr.docx
wkyra78
 

Similaire à Geeky.week3.rabbitmq (20)

An Introduction to AMQP with Code Samples
An Introduction to AMQP with Code SamplesAn Introduction to AMQP with Code Samples
An Introduction to AMQP with Code Samples
 
Azure Service Bus Performance Checklist
Azure Service Bus Performance ChecklistAzure Service Bus Performance Checklist
Azure Service Bus Performance Checklist
 
Iot hub agent
Iot hub agentIot hub agent
Iot hub agent
 
IRJET- Development of Android Application for Device to Device Communication ...
IRJET- Development of Android Application for Device to Device Communication ...IRJET- Development of Android Application for Device to Device Communication ...
IRJET- Development of Android Application for Device to Device Communication ...
 
introduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationintroduction to Windows Comunication Foundation
introduction to Windows Comunication Foundation
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
M2M for Java Developers: MQTT with Eclipse Paho - Eclipsecon Europe 2013
 
Building scalable network applications with Netty
Building scalable network applications with NettyBuilding scalable network applications with Netty
Building scalable network applications with Netty
 
Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...
 
David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...
David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...
David Wang's Presentation at Emerging Communication Conference & Awards 2009 ...
 
Move fast and consumer driven contract test things
Move fast and consumer driven contract test thingsMove fast and consumer driven contract test things
Move fast and consumer driven contract test things
 
Spring integration
Spring integrationSpring integration
Spring integration
 
Kamaelia Protocol Walkthrough
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
 
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. SaxIntroducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
 
Type-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web ServicesType-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web Services
 
Type-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web ServicesType-Safe Evolution of 
Web Services
Type-Safe Evolution of 
Web Services
 
Svcc2009 Async Ws
Svcc2009 Async WsSvcc2009 Async Ws
Svcc2009 Async Ws
 
PowerChain - Blockchain 4 Energy
PowerChain - Blockchain 4 EnergyPowerChain - Blockchain 4 Energy
PowerChain - Blockchain 4 Energy
 
Project 4 (P4) Distance Vector Routing (DV)Instructor Dr.docx
Project 4 (P4) Distance Vector Routing (DV)Instructor Dr.docxProject 4 (P4) Distance Vector Routing (DV)Instructor Dr.docx
Project 4 (P4) Distance Vector Routing (DV)Instructor Dr.docx
 
Rabbit MQ introduction
Rabbit MQ introductionRabbit MQ introduction
Rabbit MQ introduction
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Geeky.week3.rabbitmq