SlideShare a Scribd company logo
1 of 36
Intro to Message Queues Rob Paulsen@RobWasHere
“message queues”
why, what, how
AMQP
gem 'amqp'
why
require 'amqp' def publish(order) json_order = serialize_to_json(order) AMQP.start(:host => SERVER_IP) do MQ.queue('PrintQueue').publish(json_order)   end end
require 'amqp' def subscribe(&msg_callback) AMQP.start(:host => SERVER_IP) do MQ.queue('PrintQueue').subscribe(:ack => true) do |headers, payload|   	   order = deserialize_from_json(payload) headers.ack msg_callback.call(order)   	 end 	end end
def subscribe(&msg_callback) AMQP.start(:host => SERVER_IP) do     exchange = amq.fanout('OrderExchange') MQ.queue('Terminal123', :exclusive => true)         .bind(exchange).subscribe do |headers, payload|       order = deserialize_from_json(payload) headers.ack msg_callback.call(order)     end   end end
MQ Server Options  RabbitMQ OpenAMQ Apache Qpid / Redhat MRG MSMQ (Microsoft) JMS (Java) WebSphere MQ (IBM)
Notable Gems amqp (asynchronous AMQP) Bunny (synchronous AMQP) Qusion (AMQP for Rails Apps) lots more .. http://rubygems.org/search?query=amqp
Questions? (feel free to throw tomatoes now if you have to)

More Related Content

What's hot

Installing symfony within netbeans and WAMP
Installing symfony within netbeans and WAMPInstalling symfony within netbeans and WAMP
Installing symfony within netbeans and WAMPRiyad Bin Zaman
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and ChefDavid Benjamin
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
 
Cool Things in Clojure 1.9
Cool Things in Clojure 1.9Cool Things in Clojure 1.9
Cool Things in Clojure 1.9Nola Stowe
 
PowerShell: Automation for everyone
PowerShell: Automation for everyonePowerShell: Automation for everyone
PowerShell: Automation for everyoneGavin Barron
 
ElixirConf Lightning Talk: Elixir |> Production
ElixirConf Lightning Talk: Elixir |> ProductionElixirConf Lightning Talk: Elixir |> Production
ElixirConf Lightning Talk: Elixir |> ProductionJeff Weiss
 
Flask With Server-Sent Event
Flask With Server-Sent EventFlask With Server-Sent Event
Flask With Server-Sent EventTencent
 
How can you use OzML API for developing VoIP applications (like IVR, Autodial...
How can you use OzML API for developing VoIP applications (like IVR, Autodial...How can you use OzML API for developing VoIP applications (like IVR, Autodial...
How can you use OzML API for developing VoIP applications (like IVR, Autodial...Ozeki Informatics Ltd.
 
Setup ip address manually using nmcli command
Setup ip address manually using nmcli commandSetup ip address manually using nmcli command
Setup ip address manually using nmcli commandGanesh Bhosale
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014Puppet
 
Services Apps Iand Flex Applications
Services Apps Iand Flex ApplicationsServices Apps Iand Flex Applications
Services Apps Iand Flex ApplicationsSumit Kataria
 
Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09Ilya Grigorik
 
Implement server push in flask framework
Implement server push in flask frameworkImplement server push in flask framework
Implement server push in flask frameworkChi-Chia Huang
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless BallerinaBallerina
 
Everything new with PHP 7.3
Everything new with PHP 7.3Everything new with PHP 7.3
Everything new with PHP 7.3Damien Seguy
 

What's hot (20)

Installing symfony within netbeans and WAMP
Installing symfony within netbeans and WAMPInstalling symfony within netbeans and WAMP
Installing symfony within netbeans and WAMP
 
Capistrano
CapistranoCapistrano
Capistrano
 
Perl ides
Perl idesPerl ides
Perl ides
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...
 
Cool Things in Clojure 1.9
Cool Things in Clojure 1.9Cool Things in Clojure 1.9
Cool Things in Clojure 1.9
 
PowerShell: Automation for everyone
PowerShell: Automation for everyonePowerShell: Automation for everyone
PowerShell: Automation for everyone
 
ElixirConf Lightning Talk: Elixir |> Production
ElixirConf Lightning Talk: Elixir |> ProductionElixirConf Lightning Talk: Elixir |> Production
ElixirConf Lightning Talk: Elixir |> Production
 
Capistrano - Deployment Tool
Capistrano - Deployment ToolCapistrano - Deployment Tool
Capistrano - Deployment Tool
 
Flask With Server-Sent Event
Flask With Server-Sent EventFlask With Server-Sent Event
Flask With Server-Sent Event
 
How can you use OzML API for developing VoIP applications (like IVR, Autodial...
How can you use OzML API for developing VoIP applications (like IVR, Autodial...How can you use OzML API for developing VoIP applications (like IVR, Autodial...
How can you use OzML API for developing VoIP applications (like IVR, Autodial...
 
Setup ip address manually using nmcli command
Setup ip address manually using nmcli commandSetup ip address manually using nmcli command
Setup ip address manually using nmcli command
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014
 
Ansible 202
Ansible 202Ansible 202
Ansible 202
 
Services Apps Iand Flex Applications
Services Apps Iand Flex ApplicationsServices Apps Iand Flex Applications
Services Apps Iand Flex Applications
 
Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09Ruby C10K: High Performance Networking - RubyKaigi '09
Ruby C10K: High Performance Networking - RubyKaigi '09
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructure
 
Implement server push in flask framework
Implement server push in flask frameworkImplement server push in flask framework
Implement server push in flask framework
 
Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless Ballerina
 
Everything new with PHP 7.3
Everything new with PHP 7.3Everything new with PHP 7.3
Everything new with PHP 7.3
 

Viewers also liked

Using wmq with_was_and_liberty
Using wmq with_was_and_libertyUsing wmq with_was_and_liberty
Using wmq with_was_and_libertyLohit T
 
IBM Intro to Using MQ with WAS and Liberty
IBM Intro to Using MQ with WAS and LibertyIBM Intro to Using MQ with WAS and Liberty
IBM Intro to Using MQ with WAS and LibertyIBM Systems UKI
 
IBM MQ Channel Authentication
IBM MQ Channel AuthenticationIBM MQ Channel Authentication
IBM MQ Channel AuthenticationIBM Systems UKI
 
IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...
IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...
IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...T.Rob Wyatt
 
Build and Operate Your Own Certificate Management Center of Mediocrity
Build and Operate Your Own Certificate Management Center of MediocrityBuild and Operate Your Own Certificate Management Center of Mediocrity
Build and Operate Your Own Certificate Management Center of MediocrityT.Rob Wyatt
 
WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows
WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows
WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows T.Rob Wyatt
 
Iib v10 performance problem determination examples
Iib v10 performance problem determination examplesIib v10 performance problem determination examples
Iib v10 performance problem determination examplesMartinRoss_IBM
 
DevOps & Continuous Test for IIB and IBM MQ
DevOps & Continuous Test for IIB and IBM MQDevOps & Continuous Test for IIB and IBM MQ
DevOps & Continuous Test for IIB and IBM MQStuart Feasey
 
Where is My Message?: Use MQ Tools to Work Out What Applications Have Done
Where is My Message?: Use MQ Tools to Work Out What Applications Have DoneWhere is My Message?: Use MQ Tools to Work Out What Applications Have Done
Where is My Message?: Use MQ Tools to Work Out What Applications Have DoneMorag Hughson
 
WebSphere MQ CHLAUTH - including V8 changes
WebSphere MQ CHLAUTH - including V8 changesWebSphere MQ CHLAUTH - including V8 changes
WebSphere MQ CHLAUTH - including V8 changesMorag Hughson
 
IBM WebSphere MQ V8 Security Features: Deep Dive
IBM WebSphere MQ V8 Security Features: Deep DiveIBM WebSphere MQ V8 Security Features: Deep Dive
IBM WebSphere MQ V8 Security Features: Deep DiveMorag Hughson
 

Viewers also liked (12)

Using wmq with_was_and_liberty
Using wmq with_was_and_libertyUsing wmq with_was_and_liberty
Using wmq with_was_and_liberty
 
IBM MQ V8 annd JMS 2.0
IBM MQ V8 annd JMS 2.0IBM MQ V8 annd JMS 2.0
IBM MQ V8 annd JMS 2.0
 
IBM Intro to Using MQ with WAS and Liberty
IBM Intro to Using MQ with WAS and LibertyIBM Intro to Using MQ with WAS and Liberty
IBM Intro to Using MQ with WAS and Liberty
 
IBM MQ Channel Authentication
IBM MQ Channel AuthenticationIBM MQ Channel Authentication
IBM MQ Channel Authentication
 
IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...
IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...
IBM MQ CONNAUTH/CHLAUTH Doesn't Work Like You Think it Does (and if you aren'...
 
Build and Operate Your Own Certificate Management Center of Mediocrity
Build and Operate Your Own Certificate Management Center of MediocrityBuild and Operate Your Own Certificate Management Center of Mediocrity
Build and Operate Your Own Certificate Management Center of Mediocrity
 
WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows
WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows
WMQ Toolbox: 20 Scripts, One-liners, & Utilities for UNIX & Windows
 
Iib v10 performance problem determination examples
Iib v10 performance problem determination examplesIib v10 performance problem determination examples
Iib v10 performance problem determination examples
 
DevOps & Continuous Test for IIB and IBM MQ
DevOps & Continuous Test for IIB and IBM MQDevOps & Continuous Test for IIB and IBM MQ
DevOps & Continuous Test for IIB and IBM MQ
 
Where is My Message?: Use MQ Tools to Work Out What Applications Have Done
Where is My Message?: Use MQ Tools to Work Out What Applications Have DoneWhere is My Message?: Use MQ Tools to Work Out What Applications Have Done
Where is My Message?: Use MQ Tools to Work Out What Applications Have Done
 
WebSphere MQ CHLAUTH - including V8 changes
WebSphere MQ CHLAUTH - including V8 changesWebSphere MQ CHLAUTH - including V8 changes
WebSphere MQ CHLAUTH - including V8 changes
 
IBM WebSphere MQ V8 Security Features: Deep Dive
IBM WebSphere MQ V8 Security Features: Deep DiveIBM WebSphere MQ V8 Security Features: Deep Dive
IBM WebSphere MQ V8 Security Features: Deep Dive
 

Similar to Intro to MQ

Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With PhpJeremy Coates
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webclkao
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPMariano Iglesias
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with JasmineTim Tyrrell
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray testkopiczko
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Introduction To Moco
Introduction To MocoIntroduction To Moco
Introduction To MocoNaoya Ito
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioRick Copeland
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleIan Barber
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraumpatricklee
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webclkao
 
Implementing Comet using PHP
Implementing Comet using PHPImplementing Comet using PHP
Implementing Comet using PHPKing Foo
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...PHP Conference Argentina
 

Similar to Intro to MQ (18)

RabbitMQ for Perl mongers
RabbitMQ for Perl mongersRabbitMQ for Perl mongers
RabbitMQ for Perl mongers
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHP
 
201904 websocket
201904 websocket201904 websocket
201904 websocket
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with Jasmine
 
Scala45 spray test
Scala45 spray testScala45 spray test
Scala45 spray test
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Introduction To Moco
Introduction To MocoIntroduction To Moco
Introduction To Moco
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.io
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
Implementing Comet using PHP
Implementing Comet using PHPImplementing Comet using PHP
Implementing Comet using PHP
 
Swoole Overview
Swoole OverviewSwoole Overview
Swoole Overview
 
Php performance
Php performancePhp performance
Php performance
 
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
2013 - Nate Abele: HTTP ALL THE THINGS: Simplificando aplicaciones respetando...
 

Recently uploaded

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Recently uploaded (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 

Intro to MQ

  • 1. Intro to Message Queues Rob Paulsen@RobWasHere
  • 6. why
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. require 'amqp' def publish(order) json_order = serialize_to_json(order) AMQP.start(:host => SERVER_IP) do MQ.queue('PrintQueue').publish(json_order) end end
  • 19. require 'amqp' def subscribe(&msg_callback) AMQP.start(:host => SERVER_IP) do MQ.queue('PrintQueue').subscribe(:ack => true) do |headers, payload| order = deserialize_from_json(payload) headers.ack msg_callback.call(order) end end end
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. def subscribe(&msg_callback) AMQP.start(:host => SERVER_IP) do exchange = amq.fanout('OrderExchange') MQ.queue('Terminal123', :exclusive => true) .bind(exchange).subscribe do |headers, payload| order = deserialize_from_json(payload) headers.ack msg_callback.call(order) end end end
  • 33.
  • 34. MQ Server Options RabbitMQ OpenAMQ Apache Qpid / Redhat MRG MSMQ (Microsoft) JMS (Java) WebSphere MQ (IBM)
  • 35. Notable Gems amqp (asynchronous AMQP) Bunny (synchronous AMQP) Qusion (AMQP for Rails Apps) lots more .. http://rubygems.org/search?query=amqp
  • 36. Questions? (feel free to throw tomatoes now if you have to)

Editor's Notes

  1. both common terms.. refers to facilitates forasynchronous message passing
  2. Why you’d want to use them..What that involvesAnd how to interact with MQ from ruby
  3. A quick note . AMPQ is an open standard supported by some of the more popular MQ systems..Going to use it’s concepts and terms to keep things simple, but everything is more or less translatable to other MQs.
  4. Nice gem for using AMQP asyncronouslybuilt on top of EventMachine..using that in the code examples…
  5. Why use message queues ..
  6. You’ve got two applications.. A and B
  7. And you need to pass some information from one to the other… That’s a pretty common situation..
  8. things get a more complicated if B takes a while to deal with the request/msg/info….A is going to hit that box several times maybe before B can deal with the first one.
  9. No problem.. We can just add some sort of queue into B to buffer those messages so it can deal with them when it can.
  10. It’ll probably be easier if we talk about a slightly less abstract example..Use a photography store like Blacks as an example.. They’ve got a kiosk where people can upload their photos.. Pick their print sizes.. EtcAnd a printer application which is drives the actual printerKiosk needs to pass that info to the printer, but we don’t want the customer to stand there for an hour for their photos .. So we pass it asynchronously.. At this point it doesn’t have to be a message queue per se.. You could roll your own solution.. Maybe you just store a bunch of pending requests in a DB with a date stamp and an iscomplete bit … not the most elegant solution .. but whatever.. It’d work..
  11. But what happens when you need to add another printer?
  12. You could consider the kiosk and printer to be a single unit and just add more pairs… Nice thing about that is you don’t have to change any code .. Just deploy another pairBut that’s not great.. If one printer goes down for maintenance .. Or is bogged down with a big order.. This setups not going to give you any load balancing or failover niceness .. And it ties scaling of the kiosk tier to scaling the printer tier.. In reality those will probably need to change at different rates .. So …
  13. That’s bad .. Not a good idea..
  14. Another option is to have every kiosk know about every printer ..Maybe each kiosk alternates, or has a primary printer, with a failover .. Its better.. But it puts a lot of responsibility on the kiosk app to manage the overall system.. Does the kiosk check to see if a printer is currently overloaded?How does it handle printers going offline.. EtcAll of that is stuff the kiosk app shouldn’t have to care about..And things are always easier when every piece of a system is as simple as possible.So….
  15. No good
  16. A cleaner solution would be to add a message queue between the two tiersEvery kiosk just knows how to publish a new orderEvery printer just knows how to pull orders off the queueBoth apps become much simpler..
  17. Kiosk ruby code
  18. Printer ruby code
  19. So it’s much simpler to write and gives you a lot of extra benefits for free..
  20. You can add more kiosks.. Or ..
  21. Or more printers .. And not have to change any code..Or even any configuration..Just plug them into the network and turn them on.. The two tiers can scale independently now very easilyYou also just by the nature of the setup, You get free load balancing and failover behavior. If a printer goes offline.. If its overloaded…
  22. One thing to note.. Is that we have now introduced a single point of failure into the system.If the broker dies, the entire system is toast. Luckily most of the major MQ systems offer clustering and failover options ..Similar to what you’d expect from a mature database platformSo you can mitigate the risk, but it’s something to think about as you’re structuring the solution…
  23. So that’s fine .. Adding the message queue help solve a common architectural issue.. Decoupling clients from background processing tasks.. But what else can you do with it…
  24. Expanding on the photo store example .. Lets say they have some terminals that the staff use .. And they want to have a notification pop up with some details every time an order is sent for printing.
  25. You might think.. Ok .. I’ll just have them watch the same queue as the printers and everything will work..
  26. No.. That’s not going to work..that queue is setup to have one and only one consumer retrieve each message.. And once they do they remove it from the queue ..
  27. Lets take a closer look at the broker..The kiosks aren't actually writing message to a queue, They are passing them to an exchange which then delivers them to the queue In this case that’s a shared queue.. which is to say its independent of any one consumer… But we can more queues if we want (and more exchanges.. But I wont get into that).. And those queues do not need to be shared..
  28. If each terminal had its own queue… Then the exchange can deliver a copy of each order to each of those queues.. And the kiosk can deal with it as it sees fit..
  29. Ruby code for terminal..Note: Exclusive = true
  30. Messages vs RPC callsKeeping messages consumer agnostic makes things easier.
  31. If you use the AMQP compliant servers (first three)you can get a lot of stuff for free..