public class FXTradeAdapter extends CachedAdapter
An FXTradeAdapter services trading capabilities for the Executable Streaming Price (ESP), Request For Stream (RFS) and Block Trade (BLOCK) protocols.
Typically, a FXTradeAdapter will be set up as follows:
FXTradeAdapter adapter = new FXTradeAdapter(dataSource); adapter.registerESPTradeListenerFactory(new MyESPTradeListenerFactory()); adapter.registerRFSTradeListenerFactory(new MyRFSTradeListenerFactory()); adapter.registerBlockTradeListenerFactory(new MyBlockTradeListenerFactory());
Constructor and Description |
---|
FXTradeAdapter(com.caplin.datasource.DataSource dataSource)
Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.
|
FXTradeAdapter(com.caplin.datasource.DataSource dataSource,
ThreadMode threadMode)
Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.
|
FXTradeAdapter(com.caplin.datasource.DataSource dataSource,
ThreadMode threadMode,
Properties properties)
Constructs an FXTradeAdapter that will utilise the specified DataSource and its configuration for communication with the motif.
|
FXTradeAdapter(TradeAdapter tradeAdapter)
Constructs an FXTradeAdapter that will utilise the specified TradeAdapter and its configuration for communication with the motif.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserSessionListener(UserSessionListener listener)
Adds a listener that will be notified whenever a user session is created and closed.
|
void |
registerAmendTradeListenerFactory(AmendTradeListenerFactory factory)
Registers a factory that will listen to Amend Trade workflows initiated from the client.
|
void |
registerBlockTradeListenerFactory(BlockTradeListenerFactory factory)
Registers a factory that will listen to Block Trade workflows initiated from the client.
|
void |
registerBlockTradeListenerFactory(BlockTradeListenerFactory factory,
TradeValidator tradeFieldsValidator)
Registers a factory that will listen to Block Trade workflows initiated from the client.
|
void |
registerCancelTradeListenerFactory(CancelTradeListenerFactory factory)
Registers a factory that will listen to Cancel Trade workflows initiated from the client.
|
void |
registerESPTradeListenerFactory(ESPTradeListenerFactory factory)
Registers a factory that will listen to ESP Trade workflows initiated from the client.
|
void |
registerRFSTradeListenerFactory(RFSTradeListenerFactory factory)
Registers a factory that will listen to RFS Trade workflows initiated from the client.
|
void |
registerSalesInterventionTradeListenerFactory(SalesInterventionTradeListenerFactory factory)
Registers a factory that will listen to SalesIntervention Trade workflows initiated from the client.
|
void |
registerSettlementTradeListenerFactory(SettlementTradeListenerFactory factory)
Registers a factory that will listen to Settlement Trade workflows initiated from the client.
|
void |
registerTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to trade confirmation requests.
|
<T extends TradeSubjectInfo> |
registerTradeConfirmationProvider(com.caplin.datasource.namespace.Namespace namespace,
CachedMessageProvider<T> provider,
SubjectParser<T> subjectParser)
Registers a provider that is capable of responding to trade confirmation requests.
|
<T extends TradeSubjectInfo> |
registerTradeConfirmationProvider(String namespace,
CachedMessageProvider<T> provider,
SubjectParser<T> subjectParser)
Registers a provider that is capable of responding to trade confirmation requests.
|
void |
registerTradeConfirmationProvider(String namespace,
CachedMessageProvider<TradeSubjectInfo> provider)
Registers a provider that is capable of responding to trade confirmation requests.
|
void |
registerValidationTradeListenerFactory(ValidateTradeListenerFactory factory)
Registers a factory that will listen to Validation Trade workflows initiated from the client.
|
void |
removeUserSessionListener(UserSessionListener listener)
Removes a listener UserSessionListener to stop receiving session events.
|
clearCache, createActivePublisher, createActivePublisher, createCachedPublisher, createCachedPublisher
public FXTradeAdapter(com.caplin.datasource.DataSource dataSource) throws IOException
Uses a default ThreadMode
of ThreadMode.SharedThreads
dataSource
- The DataSource that will be used to receive requests for ESP and RFS trades.IOException
- If an error occurred reading configuration files for the adapter.public FXTradeAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode) throws IOException
dataSource
- The DataSource that will be used to receive requests for ESP and RFS trades.threadMode
- The thread mode to use for trades being made through the Adapter.IOException
- If an error occurred reading configuration files for the adapter.public FXTradeAdapter(com.caplin.datasource.DataSource dataSource, ThreadMode threadMode, Properties properties) throws IOException
dataSource
- The DataSource that will be used to receive requests for ESP and RFS trades.threadMode
- The thread mode to use for trades being made through the Adapter.properties
- The properties file to use when creating the TradingProvider
IOException
- If an error occurred reading configuration files for the adapter.public FXTradeAdapter(TradeAdapter tradeAdapter)
Constructs an FXTradeAdapter that will utilise the specified TradeAdapter and its configuration for communication with the motif.
Prefer this constructor if you will be implementing multiple trade adapters in a single adapter.
tradeAdapter
- The trade adapterpublic void addUserSessionListener(UserSessionListener listener)
UserSessionListener
slistener
- the listener to be notified of session lifecycle events.public void removeUserSessionListener(UserSessionListener listener)
listener
- the listener to be removed from receiving session lifecycle events.public void registerESPTradeListenerFactory(ESPTradeListenerFactory factory)
factory
- the factory that will be asked to create the ESPTradeListenerpublic void registerRFSTradeListenerFactory(RFSTradeListenerFactory factory)
factory
- the factory that will be asked to create the RFSTradeListenerpublic void registerSettlementTradeListenerFactory(SettlementTradeListenerFactory factory)
factory
- the factory that will be asked to create the SettlementTradeListenerpublic void registerValidationTradeListenerFactory(ValidateTradeListenerFactory factory)
factory
- the factory that will be asked to create the ValidateTradeListenerpublic void registerAmendTradeListenerFactory(AmendTradeListenerFactory factory)
factory
- the factory that will be asked to create the AmendTradeListenerpublic void registerCancelTradeListenerFactory(CancelTradeListenerFactory factory)
factory
- the factory that will be asked to create the CancelTradeListenerpublic void registerSalesInterventionTradeListenerFactory(SalesInterventionTradeListenerFactory factory)
factory
- the factory that will be asked to create the SalesInterventionTradeListenerpublic void registerBlockTradeListenerFactory(BlockTradeListenerFactory factory)
factory
- the factory that will be asked to create the BlockTradeListenerpublic void registerBlockTradeListenerFactory(BlockTradeListenerFactory factory, TradeValidator tradeFieldsValidator)
factory
- the factory that will be asked to create the BlockTradeListenertradeFieldsValidator
- The validator that will be used to validate the incoming client message.public void registerTradeConfirmationProvider(CachedMessageProvider<TradeSubjectInfo> provider)
provider
- the CachedMessageProvider that will receive the trade confirmation requestspublic void registerTradeConfirmationProvider(String namespace, CachedMessageProvider<TradeSubjectInfo> provider)
namespace
- the namespace to register the provider on, defaults are defined in TradeSubjectNamespacing.DefaultNamespaces
provider
- the CachedMessageProvider that will receive the trade confirmation requestspublic <T extends TradeSubjectInfo> void registerTradeConfirmationProvider(String namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser)
namespace
- the namespace to register the provider on, defaults are defined in TradeSubjectNamespacing.DefaultNamespaces
provider
- the CachedMessageProvider that will receive the trade confirmation requestssubjectParser
- the parser that will parse trade confirmation requests into an object representation of the requestpublic <T extends TradeSubjectInfo> void registerTradeConfirmationProvider(com.caplin.datasource.namespace.Namespace namespace, CachedMessageProvider<T> provider, SubjectParser<T> subjectParser)
namespace
- the namespace to register the provider on, defaults are defined in TradeSubjectNamespacing.DefaultNamespaces
provider
- the CachedMessageProvider that will receive the trade confirmation requestssubjectParser
- the parser that will parse trade confirmation requests into an object representation of the requestCopyright © 2018 Caplin Systems.