27.01.2014 Views

AMQP Specification Transport

AMQP Specification Transport

AMQP Specification Transport

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>AMQP</strong> <strong>Specification</strong>.<br />

Connection<br />

3 Connection<br />

3.1 Version Negotiation<br />

Prior to sending any frames on a connection, each peer MUST start by sending a protocol header that<br />

indicates the protocol version used on the connection. The protocol header consists of the upper case ASCII<br />

letters "<strong>AMQP</strong>" followed by 1, 0, 0, and connection flags. This is an 8-octet sequence:<br />

4 OCTETS 1 OCTET 1 OCTET 1 OCTET 1 OCTET<br />

+----------+---------+---------+----------+---------+<br />

| "<strong>AMQP</strong>" | major | minor | revision | flags |<br />

+----------+---------+---------+----------+---------+<br />

flags: 0|0|0|0|0|0|R|S<br />

R: tls-required -- The peer requires all data following the<br />

connection header to be encrypted. If R is<br />

set then S MUST also be set.<br />

S: tls-supported -- Indicates that the peer supports TLS<br />

encryption. If either peer's connection<br />

header has the R flag set then all<br />

connection data following the connection<br />

header will be encrypted, otherwise<br />

connection data will be unencrypted.<br />

Note: if one protocol header requires TLS, and the other does<br />

not support it, then both peers MUST abort the connection.<br />

An <strong>AMQP</strong> client and server agree on a protocol version as follows:<br />

• When the client opens a new socket connection to an <strong>AMQP</strong> server, it MUST send a protocol<br />

header with the client's preferred protocol version.<br />

• If the requested protocol version is supported, the server MUST send its own protocol header with<br />

the requested version to the socket, and then implement the protocol accordingly.<br />

• If the requested protocol version is not supported, the server MUST send a protocol header with a<br />

supported protocol version and then close the socket.<br />

• When choosing a protocol version to respond with, the server SHOULD choose the highest<br />

supported version that is less than or equal to the requested version. If no such version exists, the<br />

server SHOULD respond with the highest supported version.<br />

• If the server can't parse the protocol header, the server MUST send a valid protocol header with a<br />

supported protocol version and then close the socket.<br />

Based on this behavior a client can discover which protocol versions a server supports by attempting to<br />

connect with its highest supported version and reconnecting with a version less than or equal to the version<br />

received back from the server.<br />

<strong>AMQP</strong> <strong>Transport</strong> v. 1-0 Page 6 of 83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!