...
- accepts bytes from the transport (ProtocolEngine#received).
- exposes a public method (ProtocolEngine#processPendingIterator) which is used by the transport layer to pull pending tasks that produce bytes for the wire from the engine.
The engine never pushes bytes onto the transport.
Accepting bytes
The transport references an instance of the MultiVersionProtocolEngine. Internally the MultiVersionProtocolEngine delegates to other ProtocolEngine implementations. It switches from one implementation to another during this connection's life.
...
AMQPConnection_0_8Impl#received ultimately delegates to methods such as AMQPConnection_0_8Impl#receiveConnectionStartOk
- AMQPConnection_0_10Impl#received ultimately delegates to delegate ServerConnectionDelegate#connectionStartOk
- AMQPConnection_1_0Impl#received ultimately delegates to AMQPConnection_1_0Impl#receiveOpen
Producing bytes
As already said, the transport pulls tasks from the protocol engine. These tasks produce bytes. To do this, the transport calls the pending iterator which provides a stream of tasks that generate bytes for the wire. The transport keeps pulling until the output exceeds the buffer. It then tries to write the buffered bytes to the wire. If it writes more than half to the wire it continues to pull more tasks from the engine. The cycle continues until the transport cannot take more bytes (back pressure at the TCP/IP layer, or the pending iterator yields no more tasks.
...
This arrangement always means that the transport retains control of backlog of bytes to be written to the wire.
The protocol engines' pending iterator are responsible for maintaining fairness within the connection. They do this by maintaining state between invocations. For instance if a connection had sessions A, B, C, all with tasks to producer and on this output cycle, the network stopped accepting bytes after A's tasks, on the next output cycle. B would be considered first, even if A had subsequently had more work. This fairness patten is repeated through each layer of the protocol.
Queues
<todo>
Management
The Broker exposes two management layers:
- AMQP management
- HTTP management
AMQP management
AMQP management is defined by the AMQP Management specification which is currently a Working Draft at Oasis.
HTTP management
HTTP, REST and Web Management
...