34
An Introduction to the AMQP 1-0 Draft Robert Godfrey, JPMorgan

An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

An Introduction to the AMQP 1-0 Draft

Robert Godfrey, JPMorgan

Page 2: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Path to AMQP 1-0

AMQP 0-10 met reliability requirements, but complex.

Simplify wire protocol

Address the remaining business requirements Message Security Global Addressing

Disentangle Management activities from base messaging functionality

Create a model more easy to retro-fit to legacy brokers

Extensible layered protocol

Page 3: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

The AMQP 1-0 Stack

Nodes and Links

Message Layer

Application Layer(AMQP Brokers)

Peer-to-Peer Wire Protocol

Page 4: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Source Node

Link

Target Node

The AMQP Network

An AMQP Network consists of Nodes and Links.

A Node is a named source and/or sink of Messages.

Messages travel between Nodes along named, unidirectional Links.

Page 5: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Types of Links

Destructive: the transfer along the link removes the message from the source

BB

AA

CC

Non- Destructive: the message remains at the source node, and is “copied” to the destination.

Destructive: the transfer along the link removes the message from the source

Destructive: the transfer along the link removes the message from the source

Destructive: the transfer along the link removes the message from the source

AA

BB

CC

AAAA

BB

CC

BB

CC

Page 6: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Messages

Messages consist of parseable Properties and an opaque Body.

Messages may not be mutated by the AMQP Network.

The network carries information about the Message in Headers and Footers.

Header and Footer values may be modified in the Network.

Page 7: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Message Identity

A Message is assigned a globally unique identifier.

Nodes which perform transformations are creating new Messages, with new ids.

Only one “copy” of a Message can ever exist at a Node.

Page 8: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Filters

Each Link may have a Filter which evaluates which messages may travel along it.

Filters are evaluated against immutable properties of the Message.

Filter syntax determined by the Filter Type, e.g. SQL, XQuery

color = 'red'

color = 'yellow'

Page 9: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Credit

Credit x3

Credit x2

Credit x2

A message may only pass along a given link if the destination node has issued credit to the link.

Page 10: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Containers

P1

Q2

Q3

Q4

Q5

P2

C1

C2

C3

Client 1

Client 2

Broker 1

Client 3

Client 4

Page 11: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Containers

Containers contain nodes

Containers have a globally unique name

Within a container a node name will resolve to at most one node

Authentication is always with respect to a container

Observable Container state is consistent

Page 12: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

AMQP Broker

A Broker is a type of Container which Allows other containers to establish ingoing and/or outgoing

links to Queues it contains

Allows the construction of “internal” links between Queues it contains

Authenticates each and every session established with it

Provides AMQP services for Managing its Queues and internal Links

Transferring Messages to remote addresses

Can act as a Transactional Resource

Page 13: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Broker Logical Model

Queues

Persistent Store

Transfer Service

XA Txn Controller

Broker Management

Broker C

luster

Page 14: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Queues

Queues are a type of Node providing Limitted ordering guarantees

Durability

Well-Defined Message state transition

Available

Acquired

Archived

message transfer

accept/reject

messagereleased

expiry

Page 15: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Queues

Link 1 Link 2

Link 3

Messages join the Queue at the tail

Each Link maintains its own “head” pointer

Links with filters will skip over some entries

Page 16: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Example: Point to Point Messaging

Producer Queue Consumer

Page 17: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Example: Publish/Subscribe

QueuePublisher Subscriber

Subscriber

Page 18: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Emulating Exchanges

Previous versions of AMQP defined Exchanges

An Exchange defined a routing algortithm

Exchange functionality can be emulated with Nodes and Links

Page 19: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Fanout Exchange

fanout

Q1

Q2

Q3

Q4

P

C1

C2

C3

C4

Producer Exchange (Temp) Queues Consumers

P

Producer

Bindings

C1

C2

C3

C4

ConsumersQueue

Non-destructive Links

Page 20: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Direct Exchange

direct

Q1

Q2

P

C1

C2

C3

C4

Producer Exchange Queues Consumers

P

Producer

routing-key=Q1

Q2

C1

C2

C3

C4

ConsumersQueue

Destructive Links

routing-key=Q2

Q1

Page 21: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Topic Exchange

topicP

C1

C2

C3

C4

binding-key=TEMP.CA.SAN

binding-key=TEMP.CA.LAX

binding-key=TEMP.CA.*

binding-key=TEMP.CA.LAX

Page 22: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Topic Exchange

P

C1

C2

C3

C4

filter: subject = 'CA.SAN'

filter:s

ubject = 'C

A.LAX'

filter: subject like 'CA.%'

filter: subject = 'CA.LAX'

TEMP

Page 23: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Services

A Service can be thought of as an application running inside the Broker

Interact with Services by sending Messages

Each Service exposes at least one Node Name

Service Nodes are not Queues

Brokers provide services for Inter-broker transfer

Broker Management

(Option) Distributed Transaction Coordination

Page 24: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing

Standard scheme for sending messages across departmental and organisational boundaries

e-mail: local-part@domainAMQP: node-name@container

Container can be expressed as network name/address

Address is set as a Message Property “to”

Can use “reply-to” to direct replies to a local response queue

Page 25: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

AMQP Transfer Service

Messages for global addresses sent to a transfer service in the local broker – node name amqp$transfer.

Service forwards arriving message either to local node, or via authenticated links to another broker.

For convenience all node names of form x@y aliased to amqp$transfer.

Page 26: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing Example

1

local

amqp$transfer

On session with local broker, client opens outgoing link to node orders@remote

Page 27: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing Example

local

amqp$transfer

2 The local broker interprets orders@remote as an alias for amqp$transfer with the restriction that incoming messages have “to” property of “orders@remote”

orders@remote

Page 28: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing Example

local

remote

orders

amqp$transfer

amqp$transfer

orders@remote

The broker local looks up the connection information for broker remote, and ensures it has a transfer session with link to the remote amqp$transfer.

3

Page 29: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing Example

local

remote

orders

amqp$transfer

amqp$transfer

orders@remote

4The Client sends a message with the “to” property set to “orders@remote” along the link to the broker local. The local broker amqp$transfer service forwards it to the amqp$transfer service on the broker remote.

Page 30: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing Example

local

remote

orders

amqp$transfer

amqp$transfer

orders@remote

5The amqp$transfer service on the broker remote inspects the “to” property of the message and discovers that it should be routed to the “orders” node. A link is established (if necessary) and the message transferred.

Page 31: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Global Addressing

Dept. 1 Broker

Dept. 2 Broker

Region 1Gateway Broker

Dept. 3 Broker

Dept. 3 Broker

Region 2Gateway Broker

Org. AGateway Broker

Org. BGateway Broker

Internet

Page 32: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Management

Broker Management includes

Creating, Updating, and Deleting Queues

Creating, Updating, and Deleting Internal Links

Setting Threshold Alerts

Listening for broadcast events

Dealing with erroneous or poisined messages

Page 33: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Management Protocol

Broker Management commands sent over AMQP – not part of the wire protocol.

Broker has service node amqp$management

Messages containing management commands

Batched (atomic) but not transactional

Management can be federated

Page 34: An Introduction to the AMQP 1-0 Draft - RabbitMQ · 2020-06-10 · Path to AMQP 1-0 AMQP 0-10 met reliability requirements, but complex. Simplify wire protocol Address the remaining

Questions

?