Skip to content

After scheduled logout/disconnection FIX session starts connection attempts from the 1st host on the list - #152

Merged
chrjohn merged 2 commits into
quickfix-j:masterfrom
mmitya:conn-restart-from-host-0
Nov 23, 2017
Merged

chrjohn merged 2 commits into
quickfix-j:masterfrom
mmitya:conn-restart-from-host-0

Conversation

@mmitya

@mmitya mmitya commented Nov 13, 2017

Copy link
Copy Markdown
Contributor

Example
Session configuration snippet:

SocketConnectHost=host_0
SocketConnectPort=port_0
SocketConnectHost1=host_1
SocketConnectPort1=port_1
StartTime=07:30:00
EndTime=17:30:00

Issue
FIX session establishes connection to host_0 at 07:30:00
FIX session disconnects at 17:30:00
Next day FIX session established connection to host_1 at 07:30:00, but it is expected to be host_0

For my own reference: PROM-4719

connection attempts from the 1st host on the list.
@chrjohn

chrjohn commented Nov 13, 2017

Copy link
Copy Markdown
Member

Thanks for the PR, seems sensible.

@chrjohn chrjohn added this to the QFJ 2.0.1 milestone Nov 13, 2017
@chrjohn

chrjohn commented Nov 13, 2017

Copy link
Copy Markdown
Member

One further thought: wouldn't this also reset the address back to the first address in the following case:
E.g. we have 3 addresses:

  • Connection to 1 fails.
  • Connection to 2 succeeds and sets the address back to the first address upon successful connection. When connection 2 is dropped, I think that with this PR connection is initiated to address 1 but I would expect 3.

I didn't look this up in the code, just was thinking about it.

@mmitya

mmitya commented Nov 13, 2017

Copy link
Copy Markdown
Contributor Author

@chrjohn , yes, you are right - it will try FIX connection to 1 first.
But I'm not sure this is wrong.
What if host 1 was not available, but is available now?

In my case host 1 is primary, host 2 is backup. QFJ connects to primary (host 1) on Mon, but on Tue it connects to backup (host 2). If primary host 1 is not available - it doesn't mean we shouldn't try it again next day.

@chrjohn

chrjohn commented Nov 13, 2017

Copy link
Copy Markdown
Member

Hi @mmitya
but doesn't this also happen during the day? E.g. if connection 2 disconnects during the day, shouldn't connection 3 be taken next instead of 1? I would expect that it cycles through the connections intra-day.

@mmitya

mmitya commented Nov 13, 2017

Copy link
Copy Markdown
Contributor Author

Good afternoon @chrjohn ,
I don't think there is a single answer to this question.
I think it should be OK to cycle from the 1st host after successful FIX connection.

@chrjohn

chrjohn commented Nov 13, 2017

Copy link
Copy Markdown
Member

You are probably right ;) I'll give it a thought or two.

@mmitya

mmitya commented Nov 13, 2017

Copy link
Copy Markdown
Contributor Author

Great, thanks @chrjohn .

@mmitya

mmitya commented Nov 14, 2017

Copy link
Copy Markdown
Contributor Author

Good afternoon, @chrjohn.
Just decided to summarize my proposal.

Connection algorithm:
0. Wait for session has to connect.

  1. Connect to host_1 : port_1, success - goto 0, failure - goto 2.
  2. Connect to host_2 : port_2, success - goto 0, failure - goto 3.
    ...
    N. Connect to host_N : port_N, success - goto 0, failure - goto 1.

Real case example:

  • host_1 - primary server (cluster)
  • host_2 - back-up server (cluster)

If host_1 is not available at some point we should try to connect it again next time.

After every successful FIX connection and subsequent disconnection FIX engine starts from the beginning of the host list.

Hope it was helpful.

P.S. I don't think this connection establishment logic can satisfy everyone. It would be better to extract interface and have different implementations - round-robin for LB, etc. But it is a separate feature, not a quick change.

@chrjohn

chrjohn commented Nov 15, 2017

Copy link
Copy Markdown
Member

Hi @mmitya , thanks for the summary. Would it be possible to add a short description of the algorithm to https://github.com/quickfix-j/quickfixj/blob/master/quickfixj-core/src/main/doc/usermanual/usage/configuration.html ??
I think something along the lines of:

  • connections are tried one after another until one is successful
  • next connection attempt after a successful connection will start at first defined connection again
    Thanks,
    Chris.

@mmitya

mmitya commented Nov 15, 2017 •

Copy link
Copy Markdown
Contributor Author

Hello @chrjohn ,
I updated the configuration page, please have a look when you have time.
TA.

@chrjohn

chrjohn commented Nov 22, 2017 •

Copy link
Copy Markdown
Member

Hi @mmitya ,
thanks for the update and for adding SocketConnectPort<n> :)
Will merge once 2.0.0 has been released.

Thanks,
Chris.

@chrjohn
chrjohn merged commit 622b858 into quickfix-j:master Nov 23, 2017
@mmitya

mmitya commented Dec 4, 2017 •

Copy link
Copy Markdown
Contributor Author

Hello @chrjohn !
Great news, thanks.
When do you plan to release 2.0.1?
And - is it my responsibility to delete the branch?

@chrjohn

chrjohn commented Dec 4, 2017

Copy link
Copy Markdown
Member

Hi @mmitya , there is currently no plan. Luckily I got 2.0.0 out of the door before Christmas. ;)

@chrjohn chrjohn modified the milestones: QFJ 2.0.1, QFJ 2.1.0 Jul 31, 2018
DavidHV pushed a commit to DavidHV/quickfixj that referenced this pull request Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants