...
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
Queue model objects provide the messaging queues. There are several specialisations of Queue
- StandardQueue which provides a FIFO behaviour
- PriorityQueue which provides queuing ordered by a message's priority
- LVQQueue which provides a last-value or conflation queue.
Internally queues are implemented as a linked list (QueueEntryList). The linked list is implemented from first principals. It is thread safe and lock-less (it uses CAS operations).
Enqueueing
When a message is enqueued (using the AbstractQueue#enqueue() method). This adds the message to the tail of the queue and notifies a interested subscriber (consumer) about the new message. This is described by Consumer-Queue-Interactions
Subscriptions
Each subscription keeps a "pointer" (QueueContext#_lastSeenEntry) into the list denoting the point at which that particular subscription has reached. A subscription will only take a message if it is the next AVAILABLE (MessageInstance.State.AVAILABLE) entry.
The diagram below shows point to point queue with three subscribers attached.
Messages
<todo>
Management
The Broker exposes two management layers:
...