implements caplin.trading.trademodel.TradeMessageService
The SL4BTradeMessageService is an implementation of a caplin.trading.trademodel.TradeMessageService that connects one or more caplin.trading.trademodel.Trade instances with SL4B. When a Trade is created, a new requestID is associated with it, and sent with all future messages to the server, so that messages back from the server can be associated with the appropriate Trade instance. Trades may be created or restored via server messages. These server messages can be identified by having a prefix, identified by #SERVER_REQUEST_ID_PREFIX, on their requestID. If the SL4BTradeMessageService receives a message for a trade that does not exist and the requestID has the required prefix a new caplin.trading.trademodel.Trade object is created if aoTradeFactory
has been supplied to the constructor.
Attributes | Name and Description |
---|---|
|
caplin.trading.trademodel.SL4BTradeMessageService(caplin.trading.trademodel.TradeChannelMapper oTradeChannelMapper, caplin.trading.trademodel.TradeFactory oTradeFactory)
Constructs a caplin.trading.trademodel.SL4BTradeMessageService. |
Attributes | Name and Description |
---|---|
<static>
|
caplin.trading.trademodel.SL4BTradeMessageService.SERVER_REQUEST_ID_PREFIX
Prefix on a requestID that identifies a trade as originating from the server. |
Attributes | Name and Description |
---|---|
|
void
addTrade(caplin.trading.trademodel.Trade oTrade)
|
|
void
ready()
This method is called by SL4B when it is ready to receive subscriptions. |
|
void
removeTrade(caplin.trading.trademodel.Trade oTrade)
|
|
void
sendTradeEvent(String sEventName, caplin.trading.trademodel.Trade oTrade, caplin.trading.trademodel.DataHolder oData)
This method is called by the Trade when it wishes to send some data to the server. |
►
caplin.trading.trademodel.SL4BTradeMessageService(caplin.trading.trademodel.TradeChannelMapper oTradeChannelMapper, caplin.trading.trademodel.TradeFactory oTradeFactory)
Constructs a caplin.trading.trademodel.SL4BTradeMessageService.
caplin.trading.trademodel.TradeChannelMapper | oTradeChannelMapper | Maps a trade object onto a trade channel and provides a way to get a list of all the RTTP objects associated with trade channels. Must not be null. |
caplin.trading.trademodel.TradeFactory | oTradeFactory | (Optional) A factory object used to create {@see caplin.trading.trademodel.Trade trades}. |
►
<static>
String
caplin.trading.trademodel.SL4BTradeMessageService.SERVER_REQUEST_ID_PREFIX
Prefix on a requestID that identifies a trade as originating from the server.
►
void
addTrade(caplin.trading.trademodel.Trade oTrade)
caplin.trading.trademodel.Trade | oTrade | The trade to be added |
►
void
ready()
This method is called by SL4B when it is ready to receive subscriptions. This method should only be called by SL4B. (this happens after initialise() is called on the superclass).
►
void
removeTrade(caplin.trading.trademodel.Trade oTrade)
caplin.trading.trademodel.Trade | oTrade | The trade to be removed |
►
void
sendTradeEvent(String sEventName, caplin.trading.trademodel.Trade oTrade, caplin.trading.trademodel.DataHolder oData)
This method is called by the Trade when it wishes to send some data to the server.
String | sEventName | the event name that should be sent to the server. May not be null. |
caplin.trading.trademodel.Trade | oTrade | the trade object. May not be null. |
caplin.trading.trademodel.DataHolder | oData | the data that needs to be sent with this event. May not be null. |