Click here to load reader

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

  • View
    4

  • Download
    0

Embed Size (px)

Text of An Introduction to the AMQP 1-0 Draft - RabbitMQ · PDF file 2020-06-10 · Path to...

  • An Introduction to the AMQP 1-0 Draft

    Robert Godfrey, JPMorgan

  • 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

  • The AMQP 1-0 Stack

    Nodes and Links

    Message Layer

    Application Layer (AMQP Brokers)

    Peer-to-Peer Wire Protocol

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

  • 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

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

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

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

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

  • Containers

    P1 Q2

    Q3

    Q4

    Q5 P2

    C1

    C2

    C3

    Client 1

    Client 2

    Broker 1

    Client 3

    Client 4

  • 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

  • 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

  • Broker Logical Model

    Queues

    Persistent Store

    Transfer Service

    XA Txn Controller

    Broker Management

    Bro ker

    Cl ust

    er

  • Queues

     Queues are a type of Node providing  Limitted ordering guarantees  Durability  Well-Defined Message state transition

    Available

    Acquired

    Archived

    message transfer

    accept/reject

    message released

    expiry

  • 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

  • Example: Point to Point Messaging

    Producer Queue Consumer

  • Example: Publish/Subscribe

    QueuePublisher Subscriber

    Subscriber

  • Emulating Exchanges

     Previous versions of AMQP defined Exchanges

     An Exchange defined a routing algortithm

     Exchange functionality can be emulated with Nodes and Links

  • Fanout Exchange

    fanout

    Q1

    Q2

    Q3

    Q4

    P

    C1

    C2

    C3

    C4 Producer Exchange (Temp) Queues Consumers

    P

    Producer

    Bind ings

    C1

    C2

    C3

    C4 ConsumersQueue

    Non-d estru

    ctive Links

  • Direct Exchange

    direct

    Q1

    Q2

    P

    C1

    C2

    C3

    C4 Producer Exchange Queues Consumers

    P

    Producer

    routi ng-k

    ey=Q 1

    Q2

    C1

    C2

    C3

    C4 ConsumersQueue

    Destructive Links

    routing-key=Q2

    Q1

  • Topic Exchange

    topicP

    C1

    C2

    C3

    C4

    binding-key=TEMP.CA.SAN

    bin din

    g-k ey=

    TEM P.C

    A.L AX

    binding-k ey=TEMP

    .CA.*

    binding-key=TEMP.CA.LAX

  • Topic Exchange

    P

    C1

    C2

    C3

    C4

    filter: subject = 'CA.SAN'

    filte r:su

    bje ct =

    'CA .LA

    X'

    filter: sub ject like '

    CA.%'

    filter: subject = 'CA.LAX'

    TEMP

  • 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

  • Global Addressing

     Standard scheme for sending messages across departmental and organisational boundaries

     e-mail: [email protected] AMQP: [email protected]

     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

  • 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 [email protected] aliased to amqp$transfer.

  • Global Addressing Example

    1

    local

    amqp$transfer

    On session with local broker, client opens outgoing link to node [email protected]

    mailto:[email protected]

  • Global Addressing Example

    local

    amqp$transfer

    2 The local broker interprets [email protected] as an alias for amqp$transfer with the restriction that incoming messages have “to” property of “[email protected]

    [email protected]

    mailto:[email protected]

  • Global Addressing Example

    local

    remote

    orders

    amqp$transfer

    amqp$transfer

    [email protected]

    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

  • Global Addressing Example

    local

    remote

    orders

    amqp$transfer

    amqp$transfer

    [email protected]

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

    mailto:[email protected]

  • Global Addressing Example

    local

    remote

    orders

    amqp$transfer

    amqp$transfer

    [email protected]

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

  • Global Addressing

    Dept. 1 Broker

    Dept. 2 Broker

    Region 1 Gateway Broker

    Dept. 3 Broker

    Dept. 3 Broker

    Region 2 Gateway Broker

    Org. A Gateway Broker

    Org. B Gateway Broker

    Internet

  • 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

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

Search related