
Message Oriented Middleware
Decoupling your service
Github Thiago Dantas / Twitter @thiagochapa
Agenda
$ git tag -lnv0.1 Talking about entities v1.0 Topic with Durable Options v1.1 Topic Wildcard v1.2 Topic Automatic ACK v1.3 Topic Explicit ACK v1.4 Reliable Mode
let's create a BIG COMPLEX PROJECT
services instead of monolithic architecture software

We are getting bigGer

Biger biger

BIGER BIGER BIGER

BIGER BIGER BIGER BIGER

Did you see any problem ?
- creates dependencies between the applications.
- when point-to-point connectivity exists, the coupling has a quadratic growth with the number of applications.
- You must implement all communcation with other services.
RESCUE
call to mom

Rabbit MQ

Entities
- EXCHANGES
- BINDINGS
- QUEUES
EXCHANGEs
Exchanges are AMQP entities where messages are sent.
Exchanges take a message and route it into zero or more queues.
The routing algorithm used depends on the exchange type and rules called bindings.
EXCHANGES

image: http://www.rabbitmq.com/
EXCHANGE TYPES
Direct
Fanout
Topic
Headers
EXCHANGE
DIRECT

fanout

TOPIC

EXCHANGEs
Properties
NameExchange Name - ampq.* are reservedDurabilityWill survive broker restartAuto-DeleteDeleted when all queues have finished
QUEUES
Store messages that are consumed by applications.
NameQueue NameDurableWill survive a broker restartExclusiveUsed by only one connection and deleted when connection closeAuto-DeleteDeleted when last consumer unsubscribes
BINDINGS
The Clue
Rules that exchanges use to route messages to queues.
HANDS ON
git checkout -b v0.1 tags/v0.1First Date with MOM
HANDS ON
Topic
Surviving crash
git checkout -b v1.0 tags/v1.0spreading the word
HANDS ON
WiLdcard
git checkout -b 'v1.1' tags/v1.1weather forecast
HANDS ON
Acknowledgements
git checkout -b v1.1 tags/v1.1automatic ack modelgit checkout -b v1.2 tags/v1.2explicit ack model
ACK
reliable mode
Broker <----> Consumer

ACK
RELIABLE MODE
Producer <---> Broker

HANDS ON
RELIABLE MODE
git checkout -b v1.4 tags/v1.4confirm_select + ack
THANK YOU
Backshop - decoupling-services
By tdantas
Backshop - decoupling-services
Use Message Bus to decouple our Services
- 300