Multiply like rabbits with rabbit mq

21
Multiply Like Rabbits with RabbitMQ

Transcript of Multiply like rabbits with rabbit mq

Page 1: Multiply like rabbits with rabbit mq

Multiply Like Rabbits with RabbitMQ

Page 2: Multiply like rabbits with rabbit mq

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....

Page 3: Multiply like rabbits with rabbit mq

AGENDA

• Traditional RPC Calls• What is Messaging all about• Different Implementations• AMQP Protocol• RabbitMQ• Demo

Page 4: Multiply like rabbits with rabbit mq

TRADITIONAL RPC STYLE CALLS

Obj Obj

Obj

Page 5: Multiply like rabbits with rabbit mq
Page 6: Multiply like rabbits with rabbit mq

• 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?

Page 7: Multiply like rabbits with rabbit mq

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

Page 8: Multiply like rabbits with rabbit mq

• Producers lack knowledge -> Decouple

• Cross platforms-technologies -> Flexibility

• Event Driven Programming -> Scalability

• Queueing for later delivery• Asynchronous• Load balancing• Hulkyfied services

Page 9: Multiply like rabbits with rabbit mq

Usages and Patterns

Page 10: Multiply like rabbits with rabbit mq

Direct Messaging

Page 11: Multiply like rabbits with rabbit mq

Work Queues

Page 12: Multiply like rabbits with rabbit mq

Publish/Subscribe

Page 13: Multiply like rabbits with rabbit mq

Topics/Routing

Page 14: Multiply like rabbits with rabbit mq

Protocols

JMS AMQP STOMP

Page 15: Multiply like rabbits with rabbit mq

AMQP - www.amqp.org

• Advanced Message Queuing Protocol• != JMS• Standard binary protocol• Exchanges• Queuing• Routing• Reliable• Secure• Several Implementations

RabbitMQ

ActiveMQ

Qpid

StormMQ

Page 16: Multiply like rabbits with rabbit mq

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

Page 17: Multiply like rabbits with rabbit mq

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

Page 18: Multiply like rabbits with rabbit mq

• 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

Page 19: Multiply like rabbits with rabbit mq

LOAD BALANCING + ACK

Worker Queue

Consumer

Consumer

Consumer

Messages are round-robin

to each consumer

Consumer need to ack

Page 20: Multiply like rabbits with rabbit mq

DEMO TIME

• Java Producer• Java Consumer• CFML Consumer• NodeJS Consumer• JavaScript Consumer• CFML Producer

Page 21: Multiply like rabbits with rabbit mq

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