Protocol
The exact choice of messaging and internal data structures should be carefully considered as the time taken to read and write data into and out of the Aeron buffers directly impacts Aeron Cluster throughput and latency.
Static Data Protocol¶
Instruments
Instruments will hold a minimal set of data - an instrument ID, the minimum quantity and a flag indicating if active or not.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Commands relating to Instrument:
AddInstrument
- used to add a new Instrument to the state machine. Note that it includes very limited data - not even a name or otherwise. This is because this is all the state machine needs. Gateways around the edges can translate the instrument ID into something appropriate for external consumption.SetInstrumentEnabledFlag
- used to enable or disable the instrument. All RFQs in progress with this instrument would be canceled, and new RFQs for this instrument would fail validation. Two parameters are required:cusip
&enabled
.
RFQ Interaction Protocol¶
Since there are good number of possible interactions, only a few samples are included to illustrate the design.
CreateRfqCommand
This is sent by a User to initiate a new RFQ.
<sbe:message name="CreateRfqCommand" id="106" description="Command to create a RFQ">
<field name="correlation" id="1" type="uuidString"/>
<field name="expireTimeMs" id="2" type="int64"/>
<field name="quantity" id="3" type="int64"/>
<field name="requesterSide" id="4" type="Side"/>
<field name="cusip" id="5" type="cusip"/>
<field name="requesterUserId" id="6" type="int32"/>
</sbe:message>
You'll notice that the command include data on the user performing the request. The cluster will validate these user ID's against those within the Users
object.
CreateRfqConfirmEvent
This is the reply sent by the state machine to the cluster client session that sent the CreateRfqCommand. Note that the response to the RFQ Creation is encoded as a SBE enum.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
RfqCreatedEvent
This is broadcast by the state machine to all connected clients following the creation of a new RFQ.
1 2 3 4 5 6 7 |
|