Download - AMQP for phpMelb
![Page 1: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/1.jpg)
AMQPAdvanced Message Queueing Protocol
![Page 2: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/2.jpg)
Caveats
![Page 3: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/3.jpg)
Event LoggingLegacy Architecture & Problem
![Page 4: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/4.jpg)
Event Logging
ServerClient
Client
Client
MongoDB
![Page 5: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/5.jpg)
Connection Issues
ServerClient
Client
Client80
110
65
MongoDB
![Page 6: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/6.jpg)
ServerClient
Client
Client
255
MongoDB
80
110
65
Connection Issues
![Page 7: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/7.jpg)
Server MIA
ServerClient
Client
Client
0
0
0
0
MongoDB
![Page 8: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/8.jpg)
Server
Network Segmentation
0
0
0MongoDB
Client
Client
Client
![Page 9: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/9.jpg)
Total data loss
![Page 10: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/10.jpg)
DATA LOSS?!
![Page 11: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/11.jpg)
Why AMQP?
• Stable and mature
• Designed for SX markets
• Widely supported (good interop)
• Modular, Fast & Flexible
![Page 12: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/12.jpg)
Service ModelWire
AMQP Overview
AMQP
Advanced Message Queueing Protocol
![Page 13: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/13.jpg)
AMQ Model Wire
AMQP Overview
AMQP
![Page 14: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/14.jpg)
Server-side service model
defined components
rules for wiring
AMQ Model Wire
AMQP Overview
AMQP
![Page 15: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/15.jpg)
AMQ Model Wire
AMQP Overview
AMQP
Network wire-level protocol
command architecture
connections, channels, etc
![Page 16: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/16.jpg)
ExchangeQueuesBindingAMQ Model
AMQ Model
![Page 17: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/17.jpg)
QueuesExchange Binding
AMQ Model
AMQ Model
![Page 18: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/18.jpg)
Virtual Host
QueuesExchange Binding
AMQ Model
AMQ Model
![Page 19: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/19.jpg)
Virtual Host
QueuesExchange Binding
AMQ Model
AMQ Model
Publisher Consumer
![Page 20: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/20.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Publisher Consumer
![Page 21: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/21.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Router
Message
Publisher Consumer
![Page 22: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/22.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Router
Message
Publisher Consumer
![Page 23: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/23.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Router
?Message
Publisher Consumer
![Page 24: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/24.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Message
Router
Publisher Consumer
?
![Page 25: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/25.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Message
Router
Publisher
Queue: critical_error_queue
Exchange: errors_exchange
Filter: *.error.critical
Consumer
![Page 26: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/26.jpg)
Virtual Host
QueuesExchange
Binding
AMQ Model
Queue: critical_error_queue
Exchange: errors_exchange
Filter: *.error.critical
Message
Router
Publisher Consumer
![Page 27: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/27.jpg)
QueuesExchange Binding
Important notes
Publisher Consumer
‣ creates a relationship between queues and exchanges ‣ contains criteria and properties ‣ can be created at runtime by consumers
‣ store messages ‣ named ‣ bound-able to exchange ‣ criteria ‣ can be created at runtime by consumers
‣ routes messages based on criteria ‣ doesn’t store messages ‣ can inspect message content ‣ can be created at runtime consumers
‣ can create exchanges and queues
‣ can create exchanges and queues
![Page 28: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/28.jpg)
Exchange
The Exchange
![Page 29: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/29.jpg)
FanoutTopicHeadersSystem
Exchange
Types (routing algo)
The Exchange
![Page 30: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/30.jpg)
Fanout Topic Headers System
Exchange
Types (routing algo)
Direct
The Exchange
![Page 31: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/31.jpg)
Fanout Topic Headers System
Exchange
Types (routing algo)
Direct
The Exchange
![Page 32: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/32.jpg)
Exchange ‘events’
Direct Type Exchange
![Page 33: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/33.jpg)
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
Direct Type Exchange
![Page 34: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/34.jpg)
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_click_queue
Direct Type Exchange
![Page 35: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/35.jpg)
Exchange ‘events’
Binding
➡Queue: ‣ user_click_queue
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_click_queue
Direct Type Exchange
![Page 36: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/36.jpg)
Exchange ‘events’
Binding
➡Queue: ‣ user_click_queue
➡Exchange: ‣ events
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_click_queue
Direct Type Exchange
![Page 37: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/37.jpg)
Exchange ‘events’
Binding
➡Queue: ‣ user_click_queue
➡Exchange: ‣ events
➡Routing Key: ‣ event.user.click
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_click_queue
Direct Type Exchange
![Page 38: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/38.jpg)
Exchange ‘events’
Binding
➡Queue: ‣ user_click_queue
➡Exchange: ‣ events
➡Routing Key: ‣ event.user.click
Message
Message
Message
event.user.click
event.user.view
event.user.share
PHP Script
PHP Script
PHP Script
user_click_queue
Direct Type Exchange
![Page 39: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/39.jpg)
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_click_queue
user_view_queue
user_share_queue
Direct Type Exchange
![Page 40: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/40.jpg)
Yeah, so?
![Page 41: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/41.jpg)
Exchange ‘events’
What if…
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queue
![Page 42: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/42.jpg)
Exchange ‘events’
What if…
user_interaction_queue
user_shares_queue
Message
Message
Message
event.user.click
event.user.view
event.user.share
![Page 43: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/43.jpg)
Exchange ‘events’
What if…
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queue
![Page 44: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/44.jpg)
Exchange ‘events’
Topic Exchange
user_interaction_queue
Binding
Message
Message
Message
event.user.click
event.user.view
event.user.share
![Page 45: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/45.jpg)
Exchange ‘events’
user_interaction_queue
Binding
➡Queue: ‣ user_interaction_queue
➡Exchange: ‣ events
➡Routing Key: ‣ event.user.*
Message
Message
Message
event.user.click
event.user.view
event.user.share
PHP Script
PHP Script
PHP Script
Topic Exchange
![Page 46: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/46.jpg)
Message
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queue
Message
Message
event.user.*
event.user.share
Topic Exchange
![Page 47: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/47.jpg)
Can be done at runtime
![Page 48: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/48.jpg)
Message
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queue
Message
Message
Click vs Share Conversion?
event.user.*
event.user.share
Topic Exchange
![Page 49: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/49.jpg)
Message
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queue
Message
Message
Click vs Share Conversion?
event.user.*
event.user.share
Messageclick_share_queue
Message
event.user.share event.user.click
Topic Exchange
![Page 50: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/50.jpg)
Message
Exchange ‘events’
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queueMessage
live_view_queue
event.user.*
event.user.share
*.*.view
Message
Message event.staff.view
MessageMessage
Staff vs user views?
Topic Exchange
![Page 51: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/51.jpg)
I’m still pissed
![Page 52: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/52.jpg)
New Event LoggingExplorations & Implementation
![Page 53: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/53.jpg)
Revisiting Our Logging
Client
Client
Client
MongoDB
![Page 54: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/54.jpg)
Event Logging Revised
Client
Client
ClientMQ
MQ
MQ
MongoDB
![Page 55: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/55.jpg)
Event Logging Revised
Client
Client
ClientMQ
MQ
MQ
MongoDB
![Page 56: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/56.jpg)
Event Logging Revised
Client
Client
ClientMQ
MQ
MQ
MongoDB
![Page 57: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/57.jpg)
No data loss!
![Page 58: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/58.jpg)
SRSLY?!
![Page 59: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/59.jpg)
MongoDB
Event Logging Revised
MQClient
Client
Client
80
110
65
MQ
MQ
MQ
![Page 60: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/60.jpg)
MongoDBMQClient
Client
Client
80
110
65
MQ
MQ
MQ
Event Logging Revised
![Page 61: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/61.jpg)
MongoDBMQClient
Client
Client
80
110
65
MQ
MQ
MQ
MQ
Event Logging Revised
![Page 62: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/62.jpg)
MongoDB
MQ
Client
Client
Client
80
110
65
MQ
MQ
MQ
MQ
Event Logging Revised
![Page 63: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/63.jpg)
Message
Exchange ‘events’
Remember Topic Exchange?
Message
Message
Message
event.user.click
event.user.view
event.user.share
user_interaction_queue
user_shares_queueMessage
live_view_queue
event.user.*
event.user.share
*.*.view
Message
Message event.staff.view
MessageMessage
![Page 64: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/64.jpg)
MongoDB
Provides flexibility
MQClient
Client
Client
80
110
65
MQ
MQ
MQ
Reporting SQL
Notification
![Page 65: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/65.jpg)
![Page 66: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/66.jpg)
• durable
• passive
• no-wait
• exclusive
• auto-delete
• qos
• ack
• message recovery
Not Covered
![Page 67: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/67.jpg)
A quick demo of AMQPwith RabbitMQ
![Page 68: AMQP for phpMelb](https://reader033.vdocuments.net/reader033/viewer/2022052618/554f5fdeb4c905bb178b464f/html5/thumbnails/68.jpg)
Thank [email protected]