SlideShare a Scribd company logo
1 of 30
Java Messaging with
AMQP and RabbitMQ
или “JMS, давай до-свидания”
1
The big picture
2
3
Async Java World
Servlets 3.0 - async requests Servlets 3.1 - nio
Netty ReactiveX (RxJava)
Vert.xJAX-RSSpring MVC
Play Framework Akka
4
Messaging Protocols
AMQP
MQTT
STOMP
0-9-1 1-0
JMS
SMTP, POP3, IMAP
XMPP
DDS
5
Protocols comparison
6
AMQP facts
Wire Protocol
Родился в 2006 in J.P.Morgan (миллиарды сообщений в
день)
Миссия: интеграция сообщений между платформами
Поддерживается в Apache Camel, Spring Integration, Mule,..
7
AMQP is the Internet Protocol for Business
Messaging
versions:
1.0 - Now International standard:
ISO/IEC 19464:2014, OASIS (2014)
RabbitMQ supports version 1.0 via plugin
0-10, 0-9-1, 0-9, 0-8
1.0:
Not declaring broker architecture, broker management
commands. Symmetric.
8
9
Frames
Frame structure:
Sending content:
Content Header:
10
One Million Messages Per Second on Google
31 nodes, 8 virtual CPUs on each, 248 cores total
(2014, https://blog.pivotal.io/pivotal/products/rabbitmq-hits-one-million-messages-per-second-on-google-
compute-engine
11
JMS
AMQP
12
Exchange
Direct Fanout Topic Headers
Types:
Features:
• Durability (survive broker restart)
• Auto-delete (deleted when all queues have finished using it)
Default Exchange
13
14
15
Topic Exchange
* (star) can substitute for exactly one word.
# (hash) can substitute for zero or more words.
16
More Exchange Types
• Headers - по заголовкам сообщения “x-
match”=“any”/“all”
• Dead Letter Exchange (для недоставленных
сообщений)
• Constant-Hash (plugin)
• Delayed Exchange ( задержки перед отправкой)
• more …
17
Queues
• FIFO (soft)
• Durable / in-memory
• Exclusive
• Auto-delete
• Arguments (TTL,…)
18
Consumers
• Rule: One message goes to one consumer, unless redelivery
happens
• Serial per Channel (thread)
• Pull / Subscribe API
• Send acknowledgements (ack)
• can do “auto-ack” ( hits reliability )
• round robin with optional priorities
19
20
21
Что у кролика внутри
Erlang
• создан в Ericsson для телеком-железа
• functional
• lightweight processes
• good scaling over CPU
• deadlocks-aware design
• communication between network-distributed processes
• Live code upgrade
• Built in Process Monitoring and Control
22
Concurrency
23
Spring
@Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory cf = new CachingConnectionFactory("localhost");
cf.setUsername("guest");
cf.setPassword("guest");
return cf;
}
@Bean
public AmqpAdmin amqpAdmin() {
return new RabbitAdmin(connectionFactory());
}
@Bean
public RabbitTemplate rabbitTemplate() {
RabbitTemplate template = new RabbitTemplate(connectionFactory());
// Отправлять сюда
template.setRoutingKey(this.helloWorldQueueName);
// Чиать отсюда
template.setQueue(this.helloWorldQueueName);
return template;
}
24
Spring async consume
@Bean
public SimpleMessageListenerContainer listenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setQueueNames(this.helloWorldQueueName);
container.setMessageListener(new MessageListenerAdapter(new HelloWorldHandler()));
return container;
}
Sync:
AmqpTemplate amqpTemplate = context.getBean(AmqpTemplate.class);
System.out.println("Received: " + amqpTemplate.receiveAndConvert());
25
Spring: ListenerContainer
AbstractMessageListenerContainer
private volatile Object messageListener;
private volatile AcknowledgeMode acknowledgeMode = AcknowledgeMode.AUTO;
private MessageConverter messageConverter;
private ErrorHandler errorHandler = new ConditionalRejectingErrorHandler();
…
SimpleMessageListenerContainer
private volatile Executor taskExecutor = new SimpleAsyncTaskExecutor();
private volatile int concurrentConsumers = 1;
private volatile Integer maxConcurrentConsumers;
private volatile boolean exclusive;
private volatile int prefetchCount = DEFAULT_PREFETCH_COUNT; // 1
…
26
RabbitTemplate
currently, the only implementation of AMQPTemplate
Methods:
send(Message m, …), convertAndSend(Object o , …) …
recieve(): Message, recieveAndConvert(…), recieveAndReply(…) …
sendAndRecieve(…), convertSendAndRecieve(), …
Features:
• Retry and recovery (spring-retry)
• Publisher confirms and returns (ReturnCallback, ConfirmCallback)
• Message PostProcessors - after receive and before publish (zip/unzip, …)
27
Finally, AMQP vs JMS
JMS
Standard API
Native to Java world
Enterprizzy
AMQP
Truly Cross - platform
Comprehensive Topology
More Tuning (?)
Some Readings:
“Understanding the differences between AMQP and JMS”
http://www.wmrichards.com/amqp.pdf
Why Erlang is good for AMQP implementation
https://pubs.vmware.com/vfabric5/index.jsp#com.vmware.vfabric.rabbitmq.2.4/erlang.html
Alvaro Videla’s presentation “RabbitMQ Internal Architecture”
http://www.slideshare.net/old_sound/dissecting-the-rabbit
All About Messaging Protocols. What Are the Differences? by Bryon Moyer
http://www.eejournal.com/archives/articles/20150420-protocols/
Whats wrong with AMQP and how to fix it
http://www.imatix.com/articles:whats-wrong-with-amqp/
Messaging Products performance comparison
https://softwaremill.com/mqperf/
Thanks
Sincerely Yours,
Maxim Konovalov
BPC Banking Technologies, Runet Business Systems
https://www.facebook.com/maxim.konovalov.1

More Related Content

What's hot

The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message BrokerMartin Toshev
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQPOSSCON
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQAll Things Open
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging QueuesNaukri.com
 
XMPP & AMQP
XMPP & AMQPXMPP & AMQP
XMPP & AMQPvoluntas
 
An update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael KlishinAn update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael KlishinRabbitMQ Summit
 
A walk-through of the design and architecture of RabbitMQ - Ayanda Dube
A walk-through of the design and architecture of RabbitMQ - Ayanda DubeA walk-through of the design and architecture of RabbitMQ - Ayanda Dube
A walk-through of the design and architecture of RabbitMQ - Ayanda DubeRabbitMQ Summit
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPEberhard Wolff
 
Distributed messaging with AMQP
Distributed messaging with AMQPDistributed messaging with AMQP
Distributed messaging with AMQPWee Keat Chin
 
Integrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQIntegrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQGavin Roy
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQKnoldus Inc.
 
Messaging with amqp and rabbitmq
Messaging with amqp and rabbitmqMessaging with amqp and rabbitmq
Messaging with amqp and rabbitmqSelasie Hanson
 
RabbitMQ fairly-indepth
RabbitMQ fairly-indepthRabbitMQ fairly-indepth
RabbitMQ fairly-indepthWee Keat Chin
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQNahidul Kibria
 

What's hot (20)

AMQP with RabbitMQ
AMQP with RabbitMQAMQP with RabbitMQ
AMQP with RabbitMQ
 
The RabbitMQ Message Broker
The RabbitMQ Message BrokerThe RabbitMQ Message Broker
The RabbitMQ Message Broker
 
RabbitMQ & Hutch
RabbitMQ & HutchRabbitMQ & Hutch
RabbitMQ & Hutch
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQ
 
Messaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQMessaging Standards and Systems - AMQP & RabbitMQ
Messaging Standards and Systems - AMQP & RabbitMQ
 
AMQP for phpMelb
AMQP for phpMelbAMQP for phpMelb
AMQP for phpMelb
 
[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues[@NaukriEngineering] Messaging Queues
[@NaukriEngineering] Messaging Queues
 
XMPP & AMQP
XMPP & AMQPXMPP & AMQP
XMPP & AMQP
 
An update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael KlishinAn update from the RabbitMQ team - Michael Klishin
An update from the RabbitMQ team - Michael Klishin
 
A walk-through of the design and architecture of RabbitMQ - Ayanda Dube
A walk-through of the design and architecture of RabbitMQ - Ayanda DubeA walk-through of the design and architecture of RabbitMQ - Ayanda Dube
A walk-through of the design and architecture of RabbitMQ - Ayanda Dube
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
Spring RabbitMQ
Spring RabbitMQSpring RabbitMQ
Spring RabbitMQ
 
Distributed messaging with AMQP
Distributed messaging with AMQPDistributed messaging with AMQP
Distributed messaging with AMQP
 
Amqp Basic
Amqp BasicAmqp Basic
Amqp Basic
 
Integrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQIntegrating PostgreSql with RabbitMQ
Integrating PostgreSql with RabbitMQ
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 
A Closer Look at RabbitMQ
A Closer Look at RabbitMQA Closer Look at RabbitMQ
A Closer Look at RabbitMQ
 
Messaging with amqp and rabbitmq
Messaging with amqp and rabbitmqMessaging with amqp and rabbitmq
Messaging with amqp and rabbitmq
 
RabbitMQ fairly-indepth
RabbitMQ fairly-indepthRabbitMQ fairly-indepth
RabbitMQ fairly-indepth
 
Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQ
 

Viewers also liked

HornetQ Presentation On JBoss World 2009
HornetQ Presentation On JBoss World 2009HornetQ Presentation On JBoss World 2009
HornetQ Presentation On JBoss World 2009jarfield
 
Web sphere mq Online Training at bigclasses
Web sphere mq Online Training at bigclassesWeb sphere mq Online Training at bigclasses
Web sphere mq Online Training at bigclassesBigClasses.com
 
Interoperability With RabbitMq
Interoperability With RabbitMqInteroperability With RabbitMq
Interoperability With RabbitMqAlvaro Videla
 
RabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfRabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfAlvaro Videla
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questionspraveen_guda
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data IngestionAlvaro Videla
 
IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction ejlp12
 
REST vs. Messaging For Microservices
REST vs. Messaging For MicroservicesREST vs. Messaging For Microservices
REST vs. Messaging For MicroservicesEberhard Wolff
 

Viewers also liked (9)

Differences between JMS and AMQP
Differences between JMS and AMQPDifferences between JMS and AMQP
Differences between JMS and AMQP
 
HornetQ Presentation On JBoss World 2009
HornetQ Presentation On JBoss World 2009HornetQ Presentation On JBoss World 2009
HornetQ Presentation On JBoss World 2009
 
Web sphere mq Online Training at bigclasses
Web sphere mq Online Training at bigclassesWeb sphere mq Online Training at bigclasses
Web sphere mq Online Training at bigclasses
 
Interoperability With RabbitMq
Interoperability With RabbitMqInteroperability With RabbitMq
Interoperability With RabbitMq
 
RabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfRabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft Conf
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data Ingestion
 
IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction
 
REST vs. Messaging For Microservices
REST vs. Messaging For MicroservicesREST vs. Messaging For Microservices
REST vs. Messaging For Microservices
 

Similar to Java Messaging with AMQP and RabbitMQ

Chicago Kafka Meetup
Chicago Kafka MeetupChicago Kafka Meetup
Chicago Kafka MeetupCliff Gilmore
 
quickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmqquickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmqjorgesimao71
 
Building scalable network applications with Netty
Building scalable network applications with NettyBuilding scalable network applications with Netty
Building scalable network applications with NettyNLJUG
 
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...Jaap ter Woerds
 
Apache Kafka - Scalable Message Processing and more!
Apache Kafka - Scalable Message Processing and more!Apache Kafka - Scalable Message Processing and more!
Apache Kafka - Scalable Message Processing and more!Guido Schmutz
 
LLVM-based Communication Optimizations for PGAS Programs
LLVM-based Communication Optimizations for PGAS ProgramsLLVM-based Communication Optimizations for PGAS Programs
LLVM-based Communication Optimizations for PGAS ProgramsAkihiro Hayashi
 
Apache Kafka
Apache KafkaApache Kafka
Apache KafkaJoe Stein
 
Flink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San JoseFlink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San JoseKostas Tzoumas
 
Apache Flink(tm) - A Next-Generation Stream Processor
Apache Flink(tm) - A Next-Generation Stream ProcessorApache Flink(tm) - A Next-Generation Stream Processor
Apache Flink(tm) - A Next-Generation Stream ProcessorAljoscha Krettek
 
Down the RabbitMQ Hole
Down the RabbitMQ HoleDown the RabbitMQ Hole
Down the RabbitMQ HoleBizTalk360
 
Flexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache FlinkFlexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache FlinkDataWorks Summit
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageDamien Dallimore
 
Apache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikApache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikEdgar Espina
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka StreamsGuozhang Wang
 
Implementing an IPv6 Enabled Environment for a Public Cloud Tenant
Implementing an IPv6 Enabled Environment for a Public Cloud TenantImplementing an IPv6 Enabled Environment for a Public Cloud Tenant
Implementing an IPv6 Enabled Environment for a Public Cloud TenantShixiong Shang
 
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard WolffArchitecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard WolffJAX London
 
Dataservices: Processing Big Data the Microservice Way
Dataservices: Processing Big Data the Microservice WayDataservices: Processing Big Data the Microservice Way
Dataservices: Processing Big Data the Microservice WayQAware GmbH
 
Messaging for Web and Mobile with Apache ActiveMQ
Messaging for Web and Mobile with Apache ActiveMQMessaging for Web and Mobile with Apache ActiveMQ
Messaging for Web and Mobile with Apache ActiveMQdejanb
 

Similar to Java Messaging with AMQP and RabbitMQ (20)

EIP In Practice
EIP In PracticeEIP In Practice
EIP In Practice
 
Chicago Kafka Meetup
Chicago Kafka MeetupChicago Kafka Meetup
Chicago Kafka Meetup
 
quickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmqquickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmq
 
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...
 
Apache Kafka - Scalable Message Processing and more!
Apache Kafka - Scalable Message Processing and more!Apache Kafka - Scalable Message Processing and more!
Apache Kafka - Scalable Message Processing and more!
 
LLVM-based Communication Optimizations for PGAS Programs
LLVM-based Communication Optimizations for PGAS ProgramsLLVM-based Communication Optimizations for PGAS Programs
LLVM-based Communication Optimizations for PGAS Programs
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Flink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San JoseFlink Streaming Hadoop Summit San Jose
Flink Streaming Hadoop Summit San Jose
 
Apache Flink(tm) - A Next-Generation Stream Processor
Apache Flink(tm) - A Next-Generation Stream ProcessorApache Flink(tm) - A Next-Generation Stream Processor
Apache Flink(tm) - A Next-Generation Stream Processor
 
Down the RabbitMQ Hole
Down the RabbitMQ HoleDown the RabbitMQ Hole
Down the RabbitMQ Hole
 
Flexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache FlinkFlexible and Real-Time Stream Processing with Apache Flink
Flexible and Real-Time Stream Processing with Apache Flink
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
 
Apache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikApache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip Hanik
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka Streams
 
Implementing an IPv6 Enabled Environment for a Public Cloud Tenant
Implementing an IPv6 Enabled Environment for a Public Cloud TenantImplementing an IPv6 Enabled Environment for a Public Cloud Tenant
Implementing an IPv6 Enabled Environment for a Public Cloud Tenant
 
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard WolffArchitecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
Architecture | The Future of Messaging: RabbitMQ and AMQP | Eberhard Wolff
 
Dataservices: Processing Big Data the Microservice Way
Dataservices: Processing Big Data the Microservice WayDataservices: Processing Big Data the Microservice Way
Dataservices: Processing Big Data the Microservice Way
 
Messaging for Web and Mobile with Apache ActiveMQ
Messaging for Web and Mobile with Apache ActiveMQMessaging for Web and Mobile with Apache ActiveMQ
Messaging for Web and Mobile with Apache ActiveMQ
 

Recently uploaded

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Recently uploaded (20)

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 

Java Messaging with AMQP and RabbitMQ

  • 1. Java Messaging with AMQP and RabbitMQ или “JMS, давай до-свидания” 1
  • 3. 3
  • 4. Async Java World Servlets 3.0 - async requests Servlets 3.1 - nio Netty ReactiveX (RxJava) Vert.xJAX-RSSpring MVC Play Framework Akka 4
  • 7. AMQP facts Wire Protocol Родился в 2006 in J.P.Morgan (миллиарды сообщений в день) Миссия: интеграция сообщений между платформами Поддерживается в Apache Camel, Spring Integration, Mule,.. 7
  • 8. AMQP is the Internet Protocol for Business Messaging versions: 1.0 - Now International standard: ISO/IEC 19464:2014, OASIS (2014) RabbitMQ supports version 1.0 via plugin 0-10, 0-9-1, 0-9, 0-8 1.0: Not declaring broker architecture, broker management commands. Symmetric. 8
  • 9. 9
  • 11. One Million Messages Per Second on Google 31 nodes, 8 virtual CPUs on each, 248 cores total (2014, https://blog.pivotal.io/pivotal/products/rabbitmq-hits-one-million-messages-per-second-on-google- compute-engine 11
  • 13. Exchange Direct Fanout Topic Headers Types: Features: • Durability (survive broker restart) • Auto-delete (deleted when all queues have finished using it) Default Exchange 13
  • 14. 14
  • 15. 15
  • 16. Topic Exchange * (star) can substitute for exactly one word. # (hash) can substitute for zero or more words. 16
  • 17. More Exchange Types • Headers - по заголовкам сообщения “x- match”=“any”/“all” • Dead Letter Exchange (для недоставленных сообщений) • Constant-Hash (plugin) • Delayed Exchange ( задержки перед отправкой) • more … 17
  • 18. Queues • FIFO (soft) • Durable / in-memory • Exclusive • Auto-delete • Arguments (TTL,…) 18
  • 19. Consumers • Rule: One message goes to one consumer, unless redelivery happens • Serial per Channel (thread) • Pull / Subscribe API • Send acknowledgements (ack) • can do “auto-ack” ( hits reliability ) • round robin with optional priorities 19
  • 20. 20
  • 21. 21
  • 22. Что у кролика внутри Erlang • создан в Ericsson для телеком-железа • functional • lightweight processes • good scaling over CPU • deadlocks-aware design • communication between network-distributed processes • Live code upgrade • Built in Process Monitoring and Control 22
  • 24. Spring @Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory cf = new CachingConnectionFactory("localhost"); cf.setUsername("guest"); cf.setPassword("guest"); return cf; } @Bean public AmqpAdmin amqpAdmin() { return new RabbitAdmin(connectionFactory()); } @Bean public RabbitTemplate rabbitTemplate() { RabbitTemplate template = new RabbitTemplate(connectionFactory()); // Отправлять сюда template.setRoutingKey(this.helloWorldQueueName); // Чиать отсюда template.setQueue(this.helloWorldQueueName); return template; } 24
  • 25. Spring async consume @Bean public SimpleMessageListenerContainer listenerContainer() { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory()); container.setQueueNames(this.helloWorldQueueName); container.setMessageListener(new MessageListenerAdapter(new HelloWorldHandler())); return container; } Sync: AmqpTemplate amqpTemplate = context.getBean(AmqpTemplate.class); System.out.println("Received: " + amqpTemplate.receiveAndConvert()); 25
  • 26. Spring: ListenerContainer AbstractMessageListenerContainer private volatile Object messageListener; private volatile AcknowledgeMode acknowledgeMode = AcknowledgeMode.AUTO; private MessageConverter messageConverter; private ErrorHandler errorHandler = new ConditionalRejectingErrorHandler(); … SimpleMessageListenerContainer private volatile Executor taskExecutor = new SimpleAsyncTaskExecutor(); private volatile int concurrentConsumers = 1; private volatile Integer maxConcurrentConsumers; private volatile boolean exclusive; private volatile int prefetchCount = DEFAULT_PREFETCH_COUNT; // 1 … 26
  • 27. RabbitTemplate currently, the only implementation of AMQPTemplate Methods: send(Message m, …), convertAndSend(Object o , …) … recieve(): Message, recieveAndConvert(…), recieveAndReply(…) … sendAndRecieve(…), convertSendAndRecieve(), … Features: • Retry and recovery (spring-retry) • Publisher confirms and returns (ReturnCallback, ConfirmCallback) • Message PostProcessors - after receive and before publish (zip/unzip, …) 27
  • 28. Finally, AMQP vs JMS JMS Standard API Native to Java world Enterprizzy AMQP Truly Cross - platform Comprehensive Topology More Tuning (?)
  • 29. Some Readings: “Understanding the differences between AMQP and JMS” http://www.wmrichards.com/amqp.pdf Why Erlang is good for AMQP implementation https://pubs.vmware.com/vfabric5/index.jsp#com.vmware.vfabric.rabbitmq.2.4/erlang.html Alvaro Videla’s presentation “RabbitMQ Internal Architecture” http://www.slideshare.net/old_sound/dissecting-the-rabbit All About Messaging Protocols. What Are the Differences? by Bryon Moyer http://www.eejournal.com/archives/articles/20150420-protocols/ Whats wrong with AMQP and how to fix it http://www.imatix.com/articles:whats-wrong-with-amqp/ Messaging Products performance comparison https://softwaremill.com/mqperf/
  • 30. Thanks Sincerely Yours, Maxim Konovalov BPC Banking Technologies, Runet Business Systems https://www.facebook.com/maxim.konovalov.1