From Fedora Project Wiki

Revision as of 02:58, 21 May 2010 by Richards (talk | contribs)

An AMQP message body may contain 1 or more QMF messages


The Request-Response Pattern

In the request-response pattern, a requestor sends a request message to one of its peers. The peer then does one of two things: If the request can be successfully processed, a single response message is sent back to the requestor. This response contains the requested results and serves as the positive acknowledgement that the request was successfully completed.

If the request cannot be successfully completed, the peer sends a command complete message back to the requestor with an error code and error text describing what went wrong.

The sequence number in the response or command complete message is the same as the sequence number in the request.

   Requestor                                                          Peer
       |                                                               |
       | --- Request (seq) ------------------------------------------> |
       |                                                               |
       | <----------------------------------------- Response (seq) --- |
       |                                                               |
   Requestor                                                          Peer
       |                                                               |
       | --- Request (seq) ------------------------------------------> |
       |                                                               |
       | <-------------------------- Command Complete (seq, error) --- |
       |                                                               |



Broker Request Message

When a management console first establishes contact with the broker, it sends a Broker Request message to initiate the exchange.

       routing_key: broker
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 'B' |           0           |
       +-----+-----+-----+-----+-----------------------+

The Broker Request message has no payload. Broker Response Message

When the broker receives a Broker Request message, it responds with a Broker Response message. This message contains an identifier unique to the broker.

       routing_key: <reply_to from request>
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 'b' |           0           |
       +-----+-----+-----+-----+-----------------------+----------------------------+
       | brokerId (uuid)                                                            |
       +----------------------------------------------------------------------------+

Command Completion Message

       routing_key: <reply_to from request>
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 'z' |          seq          |
       +-----+-----+-----+-----+----+------------------+
       |  Completion Code (uint32)  |
       +----------------------------+------------------------------------+
       |  Completion Text (str8)                                         |
       +-----------------------------------------------------------------+

Class Query

       routing_key: broker
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 'Q' |          seq          |
       +-----+-----+-----+-----+-----------------------+----------+
       |  package name (str8)                                     |
       +----------------------------------------------------------+

Class Indication

       routing_key: <reply_to from request> (if in reply to a request)
                    schema.package          (if unsolicited)
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 'q' |          seq          |
       +-----+-----+-----+-----+---------------+-------+
       | class kind (uint8) 1=Object, 2=Event  |
       +---------------------------------------+------------------+
       | package name (str8)                                      |
       +----------------------------------------------------------+
       | class name (str8)                                        |
       +----------------------------------------------------------+
       | schema hash (bin128)                                     |
       +----------------------------------------------------------+

Schema Request

       routing_key: broker
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 'S' |          seq          |
       +-----+-----+-----+-----+-----------------------+----------+
       | packageName (str8)                                       |
       +----------------------------------------------------------+
       | className (str8)                                         |
       +----------------------------------------------------------+
       | schema-hash (bin128)                                     |
       +----------------------------------------------------------+

Schema Response

       routing_key: <reply_to from request> (if in reply to a request)
                    schema.package          (if unsolicited)
       +-----+-----+-----+-----+-----------------------+
       | 'A' | 'M' | '2' | 's' |          seq          |
       +-----+-----+-----+-----+------------+----------+
       | kind (uint8) 1=Object, 2=Event     |
       +------------------------------------+---------------------+
       | packageName (str8)                                       |
       +----------------------------------------------------------+
       | className (str8)                                         |
       +----------------------------------------------------------+
       | schema-hash (bin128)                                     |
       +-----------------------------------------------+----------+
       | propCount (uint16)                            |
       +-----------------------------------------------+
       | statCount (uint16)                            |
       +-----------------------------------------------+
       | methodCount (uint16)                          |
       +-----------------------------------------------+----------------------------+
       | propCount property records                                                 |
       +----------------------------------------------------------------------------+
       | statCount statistic records                                                |
       +----------------------------------------------------------------------------+
       | methodCount method records                                                 |
       +----------------------------------------------------------------------------+

Each property record is an AMQP map with the following fields. Optional fields may optionally be omitted from the map.