[QFJ-296] Messages logged as being sent even if the Responser is null Created: 06/Feb/08  Updated: 15/Nov/12  Resolved: 18/Jun/08

Status: Closed
Project: QuickFIX/J
Component/s: Engine, Networking
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Default
Reporter: Saqib Rasul Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

All



 Description   

In the quickfixj.Session.java class we log that a message is sent even if the Responder for that Session is null:

1770     private boolean send(String messageString) {
1771         getLog().onOutgoing(messageString);
1772         synchronized (responderSync) {
1773         if (!hasResponder()) {
1774             getLog().onEvent("No responder, not sending message");
1775             return false;
1776         }
1777         return getResponder().send(messageString);
1778         }
1779     }

as you can see in line 1771, we log the message as being sent, but we still check that the Resonder can be null and the message may eventually not be sent out



 Comments   
Comment by Saqib Rasul [ 06/Feb/08 ]

i would suggest the following fix:

private boolean send(String messageString) {
synchronized (responderSync) {
if (!hasResponder())

{ getLog().onEvent("No responder, not sending message"); return false; }

boolean messageSent = getResponder().send(messageString);

if(messageSent)
getLog().onOutgoing(messageString);
else
LogUtil.logThrowable(getLog(), "ERROR SENDING!", new Exception());

return messageSent;
}
}

even better would be to log in the Responder if the message was actually sent or not. And return the return value of the IOSession in the Respnder.

Comment by Steve Bate [ 11/Feb/08 ]

It's acceptable to send a message to a QFJ session even if the session is not currently connected. When the session connection is established later, the FIX resend protocol will transmit the message.

However, I do agree the logging could be a little more clear about what's happening. For example, we could log that the message is being stored for later transmission if there is no responder.

Generated at Sat Nov 23 08:42:12 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.