public interface TradeListener
A TradeListener is tied to a Trade and is notified of new TradeEvents related to that Trade. A TradeListener typically listens to a single Trade, but the same TradeListener instance could also be set as the TradeListener for multiple Trades.
Modifier and Type | Method and Description |
---|---|
void |
receiveEvent(TradeEvent event)
Called when an event is generated (usually as a result of a client action) that causes the
Trade to transition from one state to another.
|
void |
receiveInvalidFieldsEvent(InvalidFieldsEvent event)
A state transition defined in the trade model configuration can specify message fields that are relevant to that
transition (see the document Caplin Trading: Trade Model Configuration XML Reference).
|
void |
receiveInvalidTransitionEvent(InvalidTransitionEvent event)
Called when a client event would trigger an invalid state transition in the trade model (that is, the triggering
event is not valid for the current state of the trade model, or the trade model state requires that the event
originates from the server, not the client).
|
void receiveEvent(TradeEvent event) throws TradeException
Called when an event is generated (usually as a result of a client action) that causes the Trade to transition from one state to another. Subsequent events will not update fields on the associated Trade until the calling thread has returned from this method.
event
- The TradeEvent
that has been generated to cause this state transition.TradeException
- Thrown if the TradeEvent
cannot be handled.void receiveInvalidTransitionEvent(InvalidTransitionEvent event)
Called when a client event would trigger an invalid state transition in the trade model (that is, the triggering event is not valid for the current state of the trade model, or the trade model state requires that the event originates from the server, not the client). This situation can occur when messages cross on the wire.
When this callback is invoked, the trade model state will not have changed since the last valid event was received. Subsequent events will not update fields on the associated Trade until the calling thread has returned from this method.
event
- The InvalidTransitionEvent
containing the invalid TradeEvent and an error message.void receiveInvalidFieldsEvent(InvalidFieldsEvent event)
A state transition defined in the trade model configuration can specify message fields that are relevant to that transition (see the document Caplin Trading: Trade Model Configuration XML Reference). When at run-time a client event is received, the Trading library checks the fields in the message against the fields specified in the trade model. An example of an error would be when the configuration specifies that a particular field is required but that field is not present in the message received from the client.
When this callback is invoked, the trade model state will not have changed since the last valid event was received.
Subsequent events will not update fields on the associated Trade
until the calling thread has returned from this method.
event
- The InvalidFieldsEvent
containing the invalid TradeEvent a set of invalid fields and an error message.Please send bug reports and comments to Caplin support