Reputation: 937
We are using quickfixj in our system via apache camel:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quickfix</artifactId>
<version>${camel.version}</version>
</dependency>
We are now trying to troubleshoot the problem with our FIX channel and want to understand where the delay with message communication is – in our network while sending the message or on the bank side.
quickfixj has an outgoing message logging but the problem is logging is done before
sending the message and the message itself then sent asynchronously
private boolean send(String messageString) {
getLog().onOutgoing(messageString); // message is logged here
...
return responder.send(messageString); // async sent inside
}
So is there any way to make some log only after the message is sent? This way we will understand if there is really some delay between the first log and actually sending the message and what time that sending takes.
Thanks.
UPD: Based on Christoph's answer, trying the following:
val engine = (camelContext.getEndpoint(fixConfiguration.fixEndpoint) as QuickfixjEndpoint).engine
engine::class.java.getDeclaredField("acceptor").let {
it.isAccessible = true
val acceptor = it.get(engine) as SessionConnector
val loggingFilter = LoggingFilter()
loggingFilter.sessionOpenedLogLevel = LogLevel.NONE // don't log this event
loggingFilter.sessionCreatedLogLevel = LogLevel.NONE // don't log this event
acceptor.setIoFilterChainBuilder { chain -> chain.addLast("LoggingFilter", loggingFilter) }
}
Upvotes: 2
Views: 1182
Reputation: 3283
I tested around a little bit and think the way to go would be to employ a org.apache.mina.filter.logging.LoggingFilter
.
I assume you are using an Initiator
but it will of course also work with an Acceptor
.
LoggingFilter loggingFilter = new LoggingFilter();
loggingFilter.setSessionOpenedLogLevel(LogLevel.NONE); // don't log this event
loggingFilter.setSessionCreatedLogLevel(LogLevel.NONE); // don't log this event
initiator.setIoFilterChainBuilder(chain -> chain.addLast("LoggingFilter", loggingFilter));
This will create events like these in your log:
Feb 13, 2021 1:05:11 AM org.apache.mina.filter.logging.LoggingFilter log
INFO: SENT: 8=FIX.4.29=6735=A34=149=TW52=20210213-00:05:11.18456=ISLD98=0108=30141=Y10=244
...
Feb 13, 2021 1:05:11 AM org.apache.mina.filter.logging.LoggingFilter log
INFO: RECEIVED: 8=FIX.4.29=6735=A34=149=ISLD52=20210213-00:05:11.22456=TW98=0108=30141=Y10=239
Upvotes: 1