AMQP and RabbitMQ (OKCJUG, January 2014)

Preview:

DESCRIPTION

Introduction to AMQP and RabbitMQ

Citation preview

AMQP MessagingOKCJUG - January 2014 - Ryan Hoegg

Messaging?

Notify another system

Work queue

Decouple deployments

The Broker

Accepts messages from publishers

Delivers messages to consumers

Queue

XX

Queue

XX

Publish / Subscribe

Consumers can listen when they want

Many consumers could get the message

Open standard for messaging middleware

Defines a networking protocol

Defines semantics of broker services

The Message

Payload (byte[])

Attributes (key/value pairs)

Queue

Queue

Queue

name

attributes

durableexclusiveauto-deletearguments

Exchange

Exchange

name

type

attributes

durableauto-deletearguments

Binding

Rule used by exchange to route messages to a queue

Has optional routing key

Fanout Exchange

Simple pub/sub

Message routed to every queue bound to the exchange

Routing key is ignored

Direct Exchange

Simple point-to-point

Message routed to queue if routing key matches binding exactly

Topic Exchange

Message routed to queue based on routing-key match

Use dots within queue names and wildcards in routing keys

Setting things up

Programmable: clients declare everything

Most servers come with management tools too, though

Version Confusion

AMQP 0.9.1 widely implemented

AMQP 1.0 approved in October

They are very different

Servers

RabbitMQ: http://www.rabbitmq.com/

OpenAMQ: http://www.openamq.org

Apache Qpid: http://qpid.apache.org/

AMQP Alternatives

JMS (ActiveMQ is pretty good)

ZeroMQ

Amazon SQS

IronMQ

pubsubhubbub (RESTful)

redis

Installation

Provides installer for Windows, OSX, several linux distributions, solaris

Uses erlang runtime

Management Plugin

$ rabbitmq-plugins enable rabbitmq_management

Distributed Brokers

Clustering

HA Queues

Federation

Shovel

Recommended