Multi-Platform Enterprise
Messaging with RabbitMQ
WHO AM I?
• Luis Majano
• Computer Engineer
• Imported from El Salvador ----->
• Architecture + Software Design
• CEO of Ortus Solutions
• Professional Open Source
www.ortussolutions.com
@ortussolutions
@lmajano
Why Messaging?
What is Messaging?
Different Implementations
AMQP Protocol
RabbitMQ
Demo
WHY MESSAGING
• 3 Issues (There are more)
• RPC
• Monoliths
• Integration + Scalability
Remote Procedure Call
TRADITIONAL RPC STYLE CALLS
Obj Obj
Obj
BUT….
• Blocks Requests
• Tight coupling
• Sender always knows about receiver
• Receiver knows about sender
• What if call errors out?
• What if call hangs?
PROBLEMS WITH RPC
How can we decouple knowledge?
How can we unblock?
Monolithic Apps
Scale 

+ 

Integrate
• Integrate many internal/external systems
• Integrate many languages
• Increase Decoupling
• Work with X amount of servers
• Notify X amount of servers of stuff
• Be more reactive to exceptions
• Federation
• ….
“Software is always bound to change”
HOW DO WE MODERNIZE?
Asynchronous
Decouple instead of tight coupling
Modularize
Either with HMVC Frameworks or Microservices
Scale and Integrate
Systems, Languages,Technologies, External Resources
SET SOME GOALS
Microservices

HMVC
Messaging
+
FORMULA FOR SUCCESS
MICROSERVICES
AN APPROACH TO DEVELOPING A SINGLE
APPLICATION AS A SUITE OF SMALL SERVICES,
EACH RUNNING IN ITS OWN PROCESS AND
COMMUNICATING WITH LIGHTWEIGHT
MECHANISMS.
Martin Fowler
MICROSERVICES
M C
V
M C
V
M C
V
Provide asynchronous communications
Many protocols
Many implementations
Many design patterns
Event-Driven Programming
ENTERPRISE MESSAGING
A
FUNDAMENTAL
CHANGE IN
APPROACH OR
UNDERLYING
ASSUMPTIONS.
PARADIGM SHIFT:
MESSAGING = CHANGE
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
Asynchronous
Does 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
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
https://www.slideshare.net/HassanBOUMARSEL/rabbitmq-an-amqp-message-broker
AMQP Messaging Broker
Other Protocols: MQTT, HTTP, STOMP
Erlang
Extremely fast, reliable and secure
Polyglot: c#, erlang, java, python, ruby, node, cfml, etc
Its like a post box, post office and postman
• Producer
• Application that sends the message
• Consumer
• Application that receives the message
• Queue
• Buffer that stores the message
• Message
• Info sent from producer to consumer
• Connection
• TCP Connection between application and RabbitMQ
• Channel
• A virtual connection inside aTCP connection. 

Multiplexing
Concepts
• Exchange
• Receives messages and pushes them to
queues depending on routing rules.
Queues are bounds to exchanges
• Binding
• A link between a queue and an exchange
• Routing Key
• A key that the exchange looks to decide
how to route the message. Like an
address
• Users
• You can identify yourself to Rabbit with a
username/password and have assigned
permissions
Concepts
tryrabbitmq.com
cloudamqp.com
Managed RabbitMQ Cloud Servers
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
Usages and Patterns
Direct Messaging
Can use a routing key
Work Queues
Can use a routing key
Publish/Subscribe or Fanout
Topics/Routing
• Direct + Workers
• Routing key = queue name
• No mapping or extra fluff just a passthrough
• Topic
• Binding pattern (routing key) is match against the queue name
• Not full regex
• Ex: log.*, log#
• Not like JMSTopics, forget JMS, this is not JMS
• Fanout
• Sends messages to all queues bound to it
• One message to multiple recipients
• No load balancing, everybody gets the message
• Similar to JMS
EXCHANGETYPES
LOAD BALANCING + ACK
Worker
Queue
Consumer
Consumer
Consumer
Messages are
round-robin
to each
consumer
!
Consumer
need to
ack
DEMOTIME
Disclaimer: LIVE CODING,ANYTHING CAN HAPPEN
Disclaimer: LIVE CODING,ANYTHING CAN HAPPEN
Worker
Queue
CFML
ConsumerStock
Producer
Java
Consumer
Groovy
Consumer
NodeJS
Consumer
HTML
STOMP
CLI, Package Manager, Embedded Servlet
Container, REPL, More
install lmajano/messaging-polyglot
Q & A
• RabbitMQ In Action Book
• RabbitMQ In Depth Book
• http://www.rabbitmq.com
• http://tryrabbitmq.com
• https://github.com/lmajano/messaging-polyglot
• 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
• https://www.slideshare.net/norbu09/rabbitmq-1731778?next_slideshow=1

Multi-platform Enterprise Messaging with RabbitMQ

  • 1.
  • 2.
    WHO AM I? •Luis Majano • Computer Engineer • Imported from El Salvador -----> • Architecture + Software Design • CEO of Ortus Solutions • Professional Open Source www.ortussolutions.com @ortussolutions @lmajano
  • 3.
    Why Messaging? What isMessaging? Different Implementations AMQP Protocol RabbitMQ Demo
  • 4.
    WHY MESSAGING • 3Issues (There are more) • RPC • Monoliths • Integration + Scalability Remote Procedure Call
  • 5.
    TRADITIONAL RPC STYLECALLS Obj Obj Obj
  • 6.
  • 7.
    • Blocks Requests •Tight coupling • Sender always knows about receiver • Receiver knows about sender • What if call errors out? • What if call hangs? PROBLEMS WITH RPC How can we decouple knowledge? How can we unblock?
  • 8.
  • 10.
    Scale 
 + 
 Integrate •Integrate many internal/external systems • Integrate many languages • Increase Decoupling • Work with X amount of servers • Notify X amount of servers of stuff • Be more reactive to exceptions • Federation • ….
  • 11.
    “Software is alwaysbound to change”
  • 12.
    HOW DO WEMODERNIZE?
  • 13.
    Asynchronous Decouple instead oftight coupling Modularize Either with HMVC Frameworks or Microservices Scale and Integrate Systems, Languages,Technologies, External Resources SET SOME GOALS
  • 14.
  • 15.
    MICROSERVICES AN APPROACH TODEVELOPING A SINGLE APPLICATION AS A SUITE OF SMALL SERVICES, EACH RUNNING IN ITS OWN PROCESS AND COMMUNICATING WITH LIGHTWEIGHT MECHANISMS. Martin Fowler
  • 16.
  • 17.
    Provide asynchronous communications Manyprotocols Many implementations Many design patterns Event-Driven Programming ENTERPRISE MESSAGING
  • 18.
  • 19.
    Messaging (EMB) Producer Consumer ConsumerConsumer Messaging Bus - Broker Can be any system or language Can be any system or language Doesn’t care about consumers Asynchronous Does not get a response
  • 20.
    • Producers lackknowledge -> Decouple • Cross platforms-technologies -> Flexibility • Event Driven Programming -> Scalability • Queueing for later delivery • Asynchronous • Load balancing • Hulkyfied services
  • 21.
  • 22.
    AMQP - www.amqp.org •Advanced Message Queuing Protocol • != JMS • Standard binary protocol • Exchanges • Queuing • Routing • Reliable • Secure • Several Implementations RabbitMQ ActiveMQ Qpid StormMQ https://www.slideshare.net/HassanBOUMARSEL/rabbitmq-an-amqp-message-broker
  • 23.
    AMQP Messaging Broker OtherProtocols: MQTT, HTTP, STOMP Erlang Extremely fast, reliable and secure Polyglot: c#, erlang, java, python, ruby, node, cfml, etc Its like a post box, post office and postman
  • 24.
    • Producer • Applicationthat sends the message • Consumer • Application that receives the message • Queue • Buffer that stores the message • Message • Info sent from producer to consumer • Connection • TCP Connection between application and RabbitMQ • Channel • A virtual connection inside aTCP connection. 
 Multiplexing Concepts
  • 25.
    • Exchange • Receivesmessages and pushes them to queues depending on routing rules. Queues are bounds to exchanges • Binding • A link between a queue and an exchange • Routing Key • A key that the exchange looks to decide how to route the message. Like an address • Users • You can identify yourself to Rabbit with a username/password and have assigned permissions Concepts
  • 26.
  • 27.
  • 28.
    HOW IT WORKS? Producer Message (Body+RoutingKey) 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
  • 29.
  • 30.
  • 31.
    Work Queues Can usea routing key
  • 32.
  • 33.
  • 34.
    • Direct +Workers • Routing key = queue name • No mapping or extra fluff just a passthrough • Topic • Binding pattern (routing key) is match against the queue name • Not full regex • Ex: log.*, log# • Not like JMSTopics, forget JMS, this is not JMS • Fanout • Sends messages to all queues bound to it • One message to multiple recipients • No load balancing, everybody gets the message • Similar to JMS EXCHANGETYPES
  • 35.
    LOAD BALANCING +ACK Worker Queue Consumer Consumer Consumer Messages are round-robin to each consumer ! Consumer need to ack
  • 36.
  • 37.
    Disclaimer: LIVE CODING,ANYTHINGCAN HAPPEN Worker Queue CFML ConsumerStock Producer Java Consumer Groovy Consumer NodeJS Consumer HTML STOMP CLI, Package Manager, Embedded Servlet Container, REPL, More install lmajano/messaging-polyglot
  • 38.
    Q & A •RabbitMQ In Action Book • RabbitMQ In Depth Book • http://www.rabbitmq.com • http://tryrabbitmq.com • https://github.com/lmajano/messaging-polyglot • 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 • https://www.slideshare.net/norbu09/rabbitmq-1731778?next_slideshow=1