2023.02.02 04:11 AM
I understand that kdb-tick should be run in order from ticker.
However, if ticker is terminated for some reason, rdb does not subscribe to the re-run ticker.
Need a way to re-subscribe or a reference for implementation.
2023.02.02 07:45 AM
Hi, TorQ provides re-subscribe logic in subscriptions.q provided below.
.sub.subscribe calls a function .sub.autoreconnect which tries to reconnect to any previously subscribed tables/instruments. Initially two variables are checked .sub.AUTORECONNECT which is set to 1b in the script and if .sub.reconnectinit.
TorQ/subscriptions.q at master · AquaQAnalytics/TorQ (github.com)
2023.02.02 07:45 AM
Hi, TorQ provides re-subscribe logic in subscriptions.q provided below.
.sub.subscribe calls a function .sub.autoreconnect which tries to reconnect to any previously subscribed tables/instruments. Initially two variables are checked .sub.AUTORECONNECT which is set to 1b in the script and if .sub.reconnectinit.
TorQ/subscriptions.q at master · AquaQAnalytics/TorQ (github.com)
2023.02.03 03:02 AM
It can be done using the built-in handlers .z.pc (connection close) and .z.ts (timer). When the connection closes, you could set up a periodic timer that tries to reopen the connection.
Because doing this at the low level is cumbersome and is kind of reinventing the wheel, there are open source implementations that allow setting timers and auto-reconnecting connections, such as this one:
kdb/q/conn at main · finos/kdb (github.com)
This allows you to set up a connection that is automatically reopened using a timer. You could put the subscription code in the connect callback.
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.