Package com.caplin.motif.fx.rates
Class FXRatesAdapter
- java.lang.Object
-
- com.caplin.motif.datasource.CachedAdapter
-
- com.caplin.motif.fx.rates.FXRatesAdapter
-
public class FXRatesAdapter extends CachedAdapter
An FXRatesAdapter services rate streaming for ESP, SPOT, FORWARD and SWAP rates. The adapter also supports streaming prices for broken dates.
Typically, an FXRatesAdapter will be setup as follows:
FXRatesAdapter adapter = new FXRatesAdapter(dataSource);
-
-
Constructor Summary
Constructors Constructor Description FXRatesAdapter(com.caplin.datasource.DataSource dataSource)
Constructs an FXRatesAdapter that will utilise the specified DataSource and its configuration for communication with the motif.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FXQuotePublisher
createQuotePublisher(String namespace, CachedDataProvider<RateSubjectInfo> provider)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.FXQuotePublisher
createQuotePublisher(String namespace, CachedDataProvider<RateSubjectInfo> provider, boolean sendDiscardAfterError)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.<T extends RateSubjectInfo>
FXQuotePublishercreateQuotePublisherWithSubjectParser(com.caplin.datasource.namespace.Namespace namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.<T extends RateSubjectInfo>
FXQuotePublishercreateQuotePublisherWithSubjectParser(com.caplin.datasource.namespace.Namespace namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser, boolean sendDiscardAfterError)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.<T extends RateSubjectInfo>
FXQuotePublishercreateQuotePublisherWithSubjectParser(String namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.<T extends RateSubjectInfo>
FXQuotePublishercreateQuotePublisherWithSubjectParser(String namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser, boolean sendDiscardAfterError)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.-
Methods inherited from class com.caplin.motif.datasource.CachedAdapter
clearCache, createActivePublisher, createActivePublisher, createCachedPublisher, createCachedPublisher, createCachedPublisher, createCachedPublisher
-
-
-
-
Constructor Detail
-
FXRatesAdapter
public FXRatesAdapter(com.caplin.datasource.DataSource dataSource)
Constructs an FXRatesAdapter that will utilise the specified DataSource and its configuration for communication with the motif.- Parameters:
dataSource
- The DataSource that will be used to receive requests for ESP, SPOT, FORWARD and SWAP rates. As well as requests for prices on Broken Dates.
-
-
Method Detail
-
createQuotePublisher
public FXQuotePublisher createQuotePublisher(String namespace, CachedDataProvider<RateSubjectInfo> provider, boolean sendDiscardAfterError)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.- Parameters:
namespace
- the namespace to provide rates for, defaults are defined inRateSubjectNamespacing.DefaultNamespaces
provider
- the CachedDataProvider that will receive the rate requestssendDiscardAfterError
- If set to TRUE, your CachedDataProvider will receive an immediate callback on theCachedDataProvider.onDiscard(SubjectInfo)
method after you publish a failure message by callingSubjectMessagePublisher.sendNotFound(SubjectInfo)
. This can be useful if you want to use the same code path to clear a cache (for example) whether a subscription is ended by the client discarding it or the back end you are integrating with no longer providing the data.- Returns:
- the FXQuotePublisher able to send quotes containing rates
-
createQuotePublisher
public FXQuotePublisher createQuotePublisher(String namespace, CachedDataProvider<RateSubjectInfo> provider)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.- Parameters:
namespace
- the namespace to provide rates for, defaults are defined inRateSubjectNamespacing.DefaultNamespaces
provider
- the CachedDataProvider that will receive the rate requests- Returns:
- the FXQuotePublisher able to send quotes containing rates
-
createQuotePublisherWithSubjectParser
public <T extends RateSubjectInfo> FXQuotePublisher createQuotePublisherWithSubjectParser(String namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.- Parameters:
namespace
- the namespace to provide rates for, defaults are defined inRateSubjectNamespacing.DefaultNamespaces
provider
- the CachedDataProvider that will receive the rate requestssubjectParser
- the parser that will parse rate subject requests into an object representation of the request.- Returns:
- the FXQuotePublisher able to send quotes containing rates
-
createQuotePublisherWithSubjectParser
public <T extends RateSubjectInfo> FXQuotePublisher createQuotePublisherWithSubjectParser(String namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser, boolean sendDiscardAfterError)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.- Parameters:
namespace
- the namespace to provide rates for, defaults are defined inRateSubjectNamespacing.DefaultNamespaces
provider
- the CachedDataProvider that will receive the rate requestssubjectParser
- the parser that will parse rate subject requests into an object representation of the request.sendDiscardAfterError
- If set to TRUE, your CachedDataProvider will receive an immediate callback on theCachedDataProvider.onDiscard(SubjectInfo)
method after you publish a failure message by callingSubjectMessagePublisher.sendNotFound(SubjectInfo)
. This can be useful if you want to use the same code path to clear a cache (for example) whether a subscription is ended by the client discarding it or the back end you are integrating with no longer providing the data.- Returns:
- the FXQuotePublisher able to send quotes containing rates
-
createQuotePublisherWithSubjectParser
public <T extends RateSubjectInfo> FXQuotePublisher createQuotePublisherWithSubjectParser(com.caplin.datasource.namespace.Namespace namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.- Parameters:
namespace
- a custom namespace to provide rates forprovider
- the CachedDataProvider that will receive the rate requestssubjectParser
- the parser that will parse rate subject requests into an object representation of the request.- Returns:
- the FXQuotePublisher able to send quotes containing rates
-
createQuotePublisherWithSubjectParser
public <T extends RateSubjectInfo> FXQuotePublisher createQuotePublisherWithSubjectParser(com.caplin.datasource.namespace.Namespace namespace, CachedDataProvider<T> provider, SubjectParser<T> subjectParser, boolean sendDiscardAfterError)
Creates an FXQuotePublisher that is able to respond to messages received on the CachedDataProvider that is passed in.- Parameters:
namespace
- a custom namespace to provide rates forprovider
- the CachedDataProvider that will receive the rate requestssubjectParser
- the parser that will parse rate subject requests into an object representation of the request.sendDiscardAfterError
- If set to TRUE, your CachedDataProvider will receive an immediate callback on theCachedDataProvider.onDiscard(SubjectInfo)
method after you publish a failure message by callingSubjectMessagePublisher.sendNotFound(SubjectInfo)
. This can be useful if you want to use the same code path to clear a cache (for example) whether a subscription is ended by the client discarding it or the back end you are integrating with no longer providing the data.- Returns:
- the FXQuotePublisher able to send quotes containing rates
-
-