QuickFIX/J 遇到 END_OF_STREAM 彭博 SSL
QuickFIX/J Encountered END_OF_STREAM with Bloomberg SSL
我在使用 QuickFixJ 设置与 Bloomberg 的连接时遇到问题。我收到断开连接:遇到 END_OF_STREAM 消息。然而,我看不出这个错误是从哪里来的。
我的配置文件:
[default]
FileStorePath=target/data/quickfixlogs
FileLogPath=target/data/quickfixlogs
ConnectionType=initiator
BeginString=FIXT.1.1
SenderCompID=ARHGBETA
TargetCompID=BBGBETA
SessionQualifier=****
DefaultApplVerID=FIX.5.0SP2
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=5
SocketConnectPort=8228
SocketConnectHost=69.191.198.38
UseDataDictionary=Y
DataDictionary=FIXT11.xml
SSLEnable=Y
SSLProtocols=TLSv1.2
SSLValidateCertificates=Y
SSLCheckCertificateRevocation=N
SSLCertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\cert.pem
SSLCACertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\CACerts.pem
SSLKeyFile=.\[Beta-arhgfx-NY] ServiceId615306\pem\key.pem
SSLRequireClientCertificate=Y
[session]
BeginString=FIXT.1.1
SenderCompID=****
TargetCompID=****
DefaultApplVerID=FIX.5.0SP2
SessionQualifier=****
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=5
SocketConnectPort=8228
SocketConnectHost=69.191.198.38
SocketConnectPort1=8228
SocketConnectHost1=69.191.198.38
SocketConnectPort2=8228
SocketConnectHost2=69.191.230.38
UseDataDictionary=Y
DataDictionary=FIXT11.xml
SSLEnable=Y
SSLProtocols=TLSv1.2
SSLValidateCertificates=Y
SSLCheckCertificateRevocation=N
SSLCertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\cert.pem
SSLCACertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\CACerts.pem
SSLKeyFile=.\[Beta-arhgfx-NY] ServiceId615306\pem\key.pem
SSLCheckCertificateRevocation1=N
SSLCertificate1=.\[Beta-arhgfx-NY] ServiceId615306\pem\cert.pem
SSLCACertificate1=.\[Beta-arhgfx-NY] ServiceId615306\pem\CACerts.pem
SSLKeyFile1=.\[Beta-arhgfx-NY] ServiceId615306\pem\key.pem
SSLCheckCertificateRevocation2=N
SSLCertificate2=.\[Beta-arhgfx-NJ] ServiceId615305\pem\cert.pem
SSLCACertificate2=.\[Beta-arhgfx-NJ] ServiceId615305\pem\CACerts.pem
SSLKeyFile2=.\[Beta-arhgfx-NJ] ServiceId615305\pem\key.pem
SSLRequireClientCertificate=Y
我的配置class:
public class FixConfiguration {
private final String fileName = "quickfixj.cfg";
public ThreadedSocketInitiator threadedSocketInitiator(QuickFixJApplication application){
ThreadedSocketInitiator threadedSocketInitiator = null;
try {
SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
threadedSocketInitiator = new ThreadedSocketInitiator(application, storeFactory, settings, logFactory, messageFactory);
} catch (Exception e) {
e.printStackTrace();
}
return threadedSocketInitiator;
}
}
我的申请 class :
public class QuickFixJApplication implements Application {
@Override
public void onCreate(SessionID sessionID) {
}
@Override
public void onLogon(SessionID sessionID) {
}
@Override
public void onLogout(SessionID sessionID) {
}
@Override
public void toAdmin(Message message, SessionID sessionID) {
}
@Override
public void fromAdmin(Message message, SessionID sessionID) throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, RejectLogon {
}
@Override
public void toApp(Message message, SessionID sessionID) throws DoNotSend {
}
@Override
public void fromApp(Message message, SessionID sessionID) throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType {
}
}
我的价格发布class :
public class BloombergPricePublisher {
public ThreadedSocketInitiator threadedSocketInitiator;
public QuickFixJApplication application;
public BloombergPricePublisher(QuickFixJApplication application, ThreadedSocketInitiator threadedSocketInitiator){
super();
this.application = application;
this.threadedSocketInitiator = threadedSocketInitiator;
}
/**
* Méthode de publication d'un prix sur Bloomberg
* */
public void publish(MarketPrice marketPrice) {
MarketDataIncrementalRefresh marketDataIncrementalRefresh = createMarketDataIncrementalRefresh(marketPrice);
try{
SessionID sessionID = this.threadedSocketInitiator.getSessions().stream()
.filter(id -> id.getBeginString().equals("FIXT.1.1"))
.findFirst()
.orElseThrow(RuntimeException::new);
System.out.println(sessionID);
Session.sendToTarget(marketDataIncrementalRefresh, sessionID);
}catch (Exception e){
e.printStackTrace();
}
}
/**
* Méthode de connection à la session
* */
public static void logon (ThreadedSocketInitiator threadedSocketInitiator){
if(threadedSocketInitiator.getSessions() != null && threadedSocketInitiator.getSessions().size() > 0) {
for (SessionID sessionID: threadedSocketInitiator.getSessions()) {
Session.lookupSession(sessionID).logon();
}
System.out.println("Connecté");
}
else{
System.out.println("Impossible de se connecter");
}
}
/**
* Méthode de création d'un nouveau prix pour le publier sur Bloomberg
* @param marketPrice
* */
public MarketDataIncrementalRefresh createMarketDataIncrementalRefresh(MarketPrice marketPrice) {
MarketDataIncrementalRefresh marketDataIncrementalRefresh = new MarketDataIncrementalRefresh();
marketDataIncrementalRefresh.set(new NoMDEntries(1));
marketDataIncrementalRefresh.set(new MDBookType('0'));
return marketDataIncrementalRefresh;
}
}
我是 运行 Centos8 VM 上的代码 JAR 文件,该端口已被 Bloomberg 列入白名单。
您从哪里获得所有配置选项?您正在使用 QuickFIX/J,但看起来您从 QuickFIX (C++) 或 quickfix/n (.NET) 获取了一些设置。请参考https://www.quickfixj.org/usermanual/2.3.0/usage/configuration.html(你在另一个问题中已经提到了)。
首先引起我注意的是您的配置中的 SSLEnable
。这真的应该是 SocketUseSSL
这是一组适合我们的选项。如果他们不适合您,请与 Bloomberg 联系,如果他们能在他们的日志中看到可疑的东西,或者打开 SSL 调试日志记录以查看更多信息。
SocketUseSSL=Y
EnabledProtocols=TLSv1.2
KeyStoreType=JKS
SocketKeyStore=<absolute-path-to-keystore>
SocketKeyStorePassword=<password>
也可能相关:
我在使用 QuickFixJ 设置与 Bloomberg 的连接时遇到问题。我收到断开连接:遇到 END_OF_STREAM 消息。然而,我看不出这个错误是从哪里来的。 我的配置文件:
[default]
FileStorePath=target/data/quickfixlogs
FileLogPath=target/data/quickfixlogs
ConnectionType=initiator
BeginString=FIXT.1.1
SenderCompID=ARHGBETA
TargetCompID=BBGBETA
SessionQualifier=****
DefaultApplVerID=FIX.5.0SP2
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=5
SocketConnectPort=8228
SocketConnectHost=69.191.198.38
UseDataDictionary=Y
DataDictionary=FIXT11.xml
SSLEnable=Y
SSLProtocols=TLSv1.2
SSLValidateCertificates=Y
SSLCheckCertificateRevocation=N
SSLCertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\cert.pem
SSLCACertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\CACerts.pem
SSLKeyFile=.\[Beta-arhgfx-NY] ServiceId615306\pem\key.pem
SSLRequireClientCertificate=Y
[session]
BeginString=FIXT.1.1
SenderCompID=****
TargetCompID=****
DefaultApplVerID=FIX.5.0SP2
SessionQualifier=****
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=5
SocketConnectPort=8228
SocketConnectHost=69.191.198.38
SocketConnectPort1=8228
SocketConnectHost1=69.191.198.38
SocketConnectPort2=8228
SocketConnectHost2=69.191.230.38
UseDataDictionary=Y
DataDictionary=FIXT11.xml
SSLEnable=Y
SSLProtocols=TLSv1.2
SSLValidateCertificates=Y
SSLCheckCertificateRevocation=N
SSLCertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\cert.pem
SSLCACertificate=.\[Beta-arhgfx-NY] ServiceId615306\pem\CACerts.pem
SSLKeyFile=.\[Beta-arhgfx-NY] ServiceId615306\pem\key.pem
SSLCheckCertificateRevocation1=N
SSLCertificate1=.\[Beta-arhgfx-NY] ServiceId615306\pem\cert.pem
SSLCACertificate1=.\[Beta-arhgfx-NY] ServiceId615306\pem\CACerts.pem
SSLKeyFile1=.\[Beta-arhgfx-NY] ServiceId615306\pem\key.pem
SSLCheckCertificateRevocation2=N
SSLCertificate2=.\[Beta-arhgfx-NJ] ServiceId615305\pem\cert.pem
SSLCACertificate2=.\[Beta-arhgfx-NJ] ServiceId615305\pem\CACerts.pem
SSLKeyFile2=.\[Beta-arhgfx-NJ] ServiceId615305\pem\key.pem
SSLRequireClientCertificate=Y
我的配置class:
public class FixConfiguration {
private final String fileName = "quickfixj.cfg";
public ThreadedSocketInitiator threadedSocketInitiator(QuickFixJApplication application){
ThreadedSocketInitiator threadedSocketInitiator = null;
try {
SessionSettings settings = new SessionSettings(new FileInputStream(fileName));
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
threadedSocketInitiator = new ThreadedSocketInitiator(application, storeFactory, settings, logFactory, messageFactory);
} catch (Exception e) {
e.printStackTrace();
}
return threadedSocketInitiator;
}
}
我的申请 class :
public class QuickFixJApplication implements Application {
@Override
public void onCreate(SessionID sessionID) {
}
@Override
public void onLogon(SessionID sessionID) {
}
@Override
public void onLogout(SessionID sessionID) {
}
@Override
public void toAdmin(Message message, SessionID sessionID) {
}
@Override
public void fromAdmin(Message message, SessionID sessionID) throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, RejectLogon {
}
@Override
public void toApp(Message message, SessionID sessionID) throws DoNotSend {
}
@Override
public void fromApp(Message message, SessionID sessionID) throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType {
}
}
我的价格发布class :
public class BloombergPricePublisher {
public ThreadedSocketInitiator threadedSocketInitiator;
public QuickFixJApplication application;
public BloombergPricePublisher(QuickFixJApplication application, ThreadedSocketInitiator threadedSocketInitiator){
super();
this.application = application;
this.threadedSocketInitiator = threadedSocketInitiator;
}
/**
* Méthode de publication d'un prix sur Bloomberg
* */
public void publish(MarketPrice marketPrice) {
MarketDataIncrementalRefresh marketDataIncrementalRefresh = createMarketDataIncrementalRefresh(marketPrice);
try{
SessionID sessionID = this.threadedSocketInitiator.getSessions().stream()
.filter(id -> id.getBeginString().equals("FIXT.1.1"))
.findFirst()
.orElseThrow(RuntimeException::new);
System.out.println(sessionID);
Session.sendToTarget(marketDataIncrementalRefresh, sessionID);
}catch (Exception e){
e.printStackTrace();
}
}
/**
* Méthode de connection à la session
* */
public static void logon (ThreadedSocketInitiator threadedSocketInitiator){
if(threadedSocketInitiator.getSessions() != null && threadedSocketInitiator.getSessions().size() > 0) {
for (SessionID sessionID: threadedSocketInitiator.getSessions()) {
Session.lookupSession(sessionID).logon();
}
System.out.println("Connecté");
}
else{
System.out.println("Impossible de se connecter");
}
}
/**
* Méthode de création d'un nouveau prix pour le publier sur Bloomberg
* @param marketPrice
* */
public MarketDataIncrementalRefresh createMarketDataIncrementalRefresh(MarketPrice marketPrice) {
MarketDataIncrementalRefresh marketDataIncrementalRefresh = new MarketDataIncrementalRefresh();
marketDataIncrementalRefresh.set(new NoMDEntries(1));
marketDataIncrementalRefresh.set(new MDBookType('0'));
return marketDataIncrementalRefresh;
}
}
我是 运行 Centos8 VM 上的代码 JAR 文件,该端口已被 Bloomberg 列入白名单。
您从哪里获得所有配置选项?您正在使用 QuickFIX/J,但看起来您从 QuickFIX (C++) 或 quickfix/n (.NET) 获取了一些设置。请参考https://www.quickfixj.org/usermanual/2.3.0/usage/configuration.html(你在另一个问题中已经提到了)。
首先引起我注意的是您的配置中的 SSLEnable
。这真的应该是 SocketUseSSL
这是一组适合我们的选项。如果他们不适合您,请与 Bloomberg 联系,如果他们能在他们的日志中看到可疑的东西,或者打开 SSL 调试日志记录以查看更多信息。
SocketUseSSL=Y
EnabledProtocols=TLSv1.2
KeyStoreType=JKS
SocketKeyStore=<absolute-path-to-keystore>
SocketKeyStorePassword=<password>
也可能相关: