Interface
caplin.trading.trademodel

TradeMessageService

The TradeMessageService is the interface between a caplin.trading.trademodel.Trade and the connector that will perform the actual communication with the back-end trading system. Messages are sent from the client to the server using the #sendTradeEvent method. Messages are received from the server by the client using the caplin.trading.trademodel.Trade#processServerEvent method.

It is the responsibility of the TradeMessageService to store references to caplin.trading.trademodel.Trade objects when the #sendTradeEvent method is invoked, and to be able to pair return messages from the server with previously stored caplin.trading.trademodel.Trade objects so that the caplin.trading.trademodel.Trade#processServerEvent method can be called on the appropriate object.

Constructor Summary

Attributes Name and Description
caplin.trading.trademodel.TradeMessageService()

The TradeMessageService interface — this should never be constructed.

Method Summary

Attributes Name and Description
void addTrade(caplin.trading.trademodel.Trade oTrade)

Registers the specified trade with the trade subscriber.

void removeTrade(caplin.trading.trademodel.Trade oTrade)

Unregisters the specified trade with the trade subscriber.

void sendTradeEvent(String sEventName, caplin.trading.trademodel.Trade oTrade, caplin.trading.trademodel.DataHolder oData)

SendTradeEvent is called by the Trade when it wishes to send some data to the server.

Constructor Detail

caplin.trading.trademodel.TradeMessageService()

The TradeMessageService interface — this should never be constructed.

Method Detail

void addTrade(caplin.trading.trademodel.Trade oTrade)

Registers the specified trade with the trade subscriber. Will throw an exception if the object passed in is not an instance of caplin.trading.trademodel.Trade

Parameters
caplin.trading.trademodel.Trade oTrade the trade object. May not be null.

void removeTrade(caplin.trading.trademodel.Trade oTrade)

Unregisters the specified trade with the trade subscriber. The trade subscriber may now clean up any allocated resources for that trade.

Parameters
caplin.trading.trademodel.Trade oTrade the trade object. May not be null.

void sendTradeEvent(String sEventName, caplin.trading.trademodel.Trade oTrade, caplin.trading.trademodel.DataHolder oData)

SendTradeEvent is called by the Trade when it wishes to send some data to the server.

Parameters
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.