Package biz.onixs.cme.stp.handler
Class Session
- java.lang.Object
-
- biz.onixs.cme.stp.handler.Session
-
public class Session extends Object
Session is main class for CME STP connection.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCustomApplicationVersionCustom Application Version.static StringFixmlExtensionVersionFIXML Version.static StringFixSchemaReleaseDateFIX Schema Release Date.static StringFixVersionFIX version.
-
Constructor Summary
Constructors Constructor Description Session(URL url, String senderCompID, String senderSubID, String password)Session constructor.Session(URL url, String senderCompID, String senderSubID, String password, int pollingInterval)Session constructor.Session(URL url, String senderCompID, String senderSubID, String password, int pollingInterval, String sslProtocol)Session constructor.Session(URL url, String senderCompID, String senderSubID, String password, String sslProtocol)Session constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the connection and dispose resourcesstatic StringgetLicenseDirectory()Gets path to directory where license file is located.LocalDategetLicenseExpirationDate()static StringgetLicenseFile()Gets license file name or absolute path to license.Collection<TradeCaptureReportRequest>getSubscriptions()voidquery(TradeCaptureReportRequest request)Query request to retrieve the current status of trades.voidregisterErrorListener(ErrorListener errorListener)Register listener of error event.voidregisterFixmlMessageListener(FixmlMessageListener messageListener)Register listener of FIXML message events.voidregisterMessageListener(MessageListener messageListener)Register listener of message events.voidregisterWarningListener(WarningListener warningListener)Register a listener for non-fatal parsing warnings.static voidsetLicenseDirectory(String value)Sets path to directory where license file is located.static voidsetLicenseFile(String value)Sets license file name or absolute path to license.Stringsubscribe()Subscribe to Trade Capture Reporting without filtering (all trades).Stringsubscribe(TradeCaptureReportRequest request)Subscribe to Trade Capture Reporting with filtering.Stringsubscribe(ZonedDateTime startTime)Subscribe to Trade Capture Reporting without filtering (all trades).voidunregisterErrorListener()Unregister listener of error event.voidunregisterFixmlMessageListener()Unregister listener of Fixml message events.voidunregisterMessageListener()Unregister listener of message events.voidunregisterWarningListener()Unregister the warning listener.voidunsubscribe(String id)Unsubscribe from Trade Capture Reporting.
-
-
-
Field Detail
-
FixVersion
public static final String FixVersion
FIX version.- See Also:
- Constant Field Values
-
FixSchemaReleaseDate
public static final String FixSchemaReleaseDate
FIX Schema Release Date.- See Also:
- Constant Field Values
-
FixmlExtensionVersion
public static final String FixmlExtensionVersion
FIXML Version.- See Also:
- Constant Field Values
-
CustomApplicationVersion
public static final String CustomApplicationVersion
Custom Application Version.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Session
public Session(URL url, String senderCompID, String senderSubID, String password) throws LicenseException
Session constructor. Polling interval = 3 sec. SSL Protocol = TLS 1.2- Parameters:
url- Uri of CME server.senderCompID- Assigned value used to identify customer firm sending message.senderSubID- The user ID assigned to the sender must be provided in all uppercase letters.password- CME assigned password.- Throws:
LicenseException- when the License is missing or overdue
-
Session
public Session(URL url, String senderCompID, String senderSubID, String password, int pollingInterval) throws LicenseException
Session constructor. SSL Protocol = TLS 1.2- Parameters:
url- Uri of CME server.senderCompID- Assigned value used to identify customer firm sending message.senderSubID- The user ID assigned to the sender must be provided in all uppercase letters.password- CME assigned password.pollingInterval- Interval in milliseconds between normal subscription polls. Failed polls retry after at least three seconds.- Throws:
LicenseException- when the License is missing or overdue
-
Session
public Session(URL url, String senderCompID, String senderSubID, String password, String sslProtocol) throws LicenseException
Session constructor. Polling interval = 3 sec.- Parameters:
url- Uri of CME server.senderCompID- Assigned value used to identify customer firm sending message.senderSubID- The user ID assigned to the sender must be provided in all uppercase letters.password- CME assigned password.sslProtocol- SSL Protocol. Values like 'TLSv1.1' or 'TLSv1.2' can be used. Please see protocol names at SSLContext Algorithms.- Throws:
LicenseException- when the License is missing or overdue
-
Session
public Session(URL url, String senderCompID, String senderSubID, String password, int pollingInterval, String sslProtocol) throws LicenseException
Session constructor.- Parameters:
url- Uri of CME server.senderCompID- Assigned value used to identify customer firm sending message.senderSubID- The user ID assigned to the sender must be provided in all uppercase letters.password- CME assigned password.pollingInterval- Interval in milliseconds between normal subscription polls. Failed polls retry after at least three seconds.sslProtocol- SSL Protocol. Values like 'TLSv1.1' or 'TLSv1.2' can be used. Please see protocol names at SSLContext Algorithms.- Throws:
LicenseException- when the License is missing or overdue
-
-
Method Detail
-
getLicenseFile
public static String getLicenseFile()
Gets license file name or absolute path to license.- Returns:
- License file name or absolute path to license.
-
setLicenseFile
public static void setLicenseFile(String value)
Sets license file name or absolute path to license.- Parameters:
value- License file name or absolute path to license.
-
getLicenseDirectory
public static String getLicenseDirectory()
Gets path to directory where license file is located.- Returns:
- Path to directory where license file is located.
-
setLicenseDirectory
public static void setLicenseDirectory(String value)
Sets path to directory where license file is located.- Parameters:
value- Path to directory where license file is located.
-
close
public void close() throws InterruptedExceptionCloses the connection and dispose resources- Throws:
InterruptedException- when thread is interrupted during closing
-
getLicenseExpirationDate
public final LocalDate getLicenseExpirationDate()
- Returns:
- license expiration date.
-
getSubscriptions
public final Collection<TradeCaptureReportRequest> getSubscriptions()
- Returns:
- collection of all active subscriptions to Trade Capture Reports.
-
registerErrorListener
public void registerErrorListener(ErrorListener errorListener)
Register listener of error event.- Parameters:
errorListener- Listener.
-
unregisterErrorListener
public void unregisterErrorListener()
Unregister listener of error event.
-
registerWarningListener
public void registerWarningListener(WarningListener warningListener)
Register a listener for non-fatal parsing warnings.- Parameters:
warningListener- Listener.
-
unregisterWarningListener
public void unregisterWarningListener()
Unregister the warning listener.
-
registerMessageListener
public void registerMessageListener(MessageListener messageListener)
Register listener of message events.- Parameters:
messageListener- Listener.
-
unregisterMessageListener
public void unregisterMessageListener()
Unregister listener of message events.
-
registerFixmlMessageListener
public void registerFixmlMessageListener(FixmlMessageListener messageListener)
Register listener of FIXML message events.- Parameters:
messageListener- Listener.
-
unregisterFixmlMessageListener
public void unregisterFixmlMessageListener()
Unregister listener of Fixml message events.
-
subscribe
public final String subscribe(TradeCaptureReportRequest request)
Subscribe to Trade Capture Reporting with filtering.- Parameters:
request- Request which contains filtering information.- Returns:
- Subscription ID.
-
subscribe
public final String subscribe()
Subscribe to Trade Capture Reporting without filtering (all trades).- Returns:
- Subscription ID.
-
subscribe
public final String subscribe(ZonedDateTime startTime)
Subscribe to Trade Capture Reporting without filtering (all trades).- Parameters:
startTime- The starting time of the subscription.- Returns:
- Subscription ID.
-
unsubscribe
public final void unsubscribe(String id)
Unsubscribe from Trade Capture Reporting.- Parameters:
id- Subscription ID.
-
query
public final void query(TradeCaptureReportRequest request)
Query request to retrieve the current status of trades.- Parameters:
request- Request which contains filtering information.
-
-