2

What happens when we try to send a message on a session that is not connected?

I have found that the QuickFIXJ method for sending the message throws a checked exception, but I want to know under which circumstances is this exception thrown.

h.i
  • 515
  • 1
  • 5
  • 16
  • 1
    Why is there a doubt on that ? When you don't have a socket connection how can you send data and where will you send on that ? Messages only flow thorugh after connection and login has happened. – DumbCoder May 28 '15 at 09:03
  • i want to know when is the session not found exception gets thrown. if a session was available at the time of sending but becomes unavailable after that then what happens? will the session not found exception be thrown in that case? – h.i May 28 '15 at 13:49

1 Answers1

0

The SessionNotFound exception will be thrown if the session is not available / disconnected at the time you send a message. However, if the session becomes unavailable after that, no exception is thrown right away, and it will be thrown when you try to send the next message.

If you want to detect disconnects and handle them, you can check this answer: QuickFIX/J: how to detect when connection fails?

  • 1
    Actually `SessionNotFound` will be thrown if the session is unknown, i.e. not managed by any Acceptor or Initiator. If it is merely disconnected the message will be put to the message store to be sent when the connection becomes available again (unless the message store gets reset in the meantime). – Christoph John Jun 23 '21 at 22:27