Multiply like rabbits with rabbit mq
-
Upload
coldfusionconference -
Category
Technology
-
view
65 -
download
0
Transcript of Multiply like rabbits with rabbit mq
Multiply Like Rabbits with RabbitMQ
WHO AM I?
• Luis Majano
• Born in El Salvador ------------------>
• Architecture + Software Design
• CEO of Ortus Solutions
• Adobe Community Professional
• Creator of all things Box: ColdBox, ContentBox, CommandBox....
AGENDA
• Traditional RPC Calls• What is Messaging all about• Different Implementations• AMQP Protocol• RabbitMQ• Demo
TRADITIONAL RPC STYLE CALLS
Obj Obj
Obj
• Blocks Requests• Asynchronous, partial solution, still 1-1 relationship• Sender always knows about receiver• Receiver knows about sender
PROBLEMS WITH RPC
How can we decouple knowledge?How can we apply messaging patterns to our apps?
Messaging (EMB)
Producer
Consumer Consumer Consumer
Messaging Bus - Broker
Can be any system or
language
Can be any system or
language
Doesn’t care about consumers
AsynchronousDoes not get a
response
• Producers lack knowledge -> Decouple
• Cross platforms-technologies -> Flexibility
• Event Driven Programming -> Scalability
• Queueing for later delivery• Asynchronous• Load balancing• Hulkyfied services
Usages and Patterns
Direct Messaging
Work Queues
Publish/Subscribe
Topics/Routing
Protocols
JMS AMQP STOMP
AMQP - www.amqp.org
• Advanced Message Queuing Protocol• != JMS• Standard binary protocol• Exchanges• Queuing• Routing• Reliable• Secure• Several Implementations
RabbitMQ
ActiveMQ
Qpid
StormMQ
AMQP Messaging BrokerErlang
Extremely fast, reliable and secureLanguages: c#, erlang, java, python, ruby, node, etc
Accepts and forwards messagesIts like a post box, post office and postman
HOW IT WORKS?Producer
Message(Body+Routing Key)
Exchange (Bindings via Routing Key)
Body = binary, json, anything
stock.prices
stock.run
log.error cluster
Queues are bound to exchanges with patterns
Routing key = Bindings
Queues
• Direct
• Routing key = queue name• No mapping or extra fluff just a passthrough• Similar to JMS
• Topic
• Binding pattern (routing key) is match against the queue name• Not full regex• Ex: log.*, log#• Not like JMS Topics, forget JMS, this is not JMS
• Fanout + More
EXCHANGE TYPES
LOAD BALANCING + ACK
Worker Queue
Consumer
Consumer
Consumer
Messages are round-robin
to each consumer
Consumer need to ack
DEMO TIME
• Java Producer• Java Consumer• CFML Consumer• NodeJS Consumer• JavaScript Consumer• CFML Producer
Q & A
• RabbitMQ In Action Book• http://www.rabbitmq.com• http://tryrabbitmq.com/ • https://github.com/RabbitMQSimulator/RabbitMQSimulator• http://koo.fi/blog/2013/02/18/web-messaging-with-rabbitmq-web-stomp-and-
sockjs/• https://github.com/robharrop/presentations.git