TorQ - RDB subscribing to specific segmented tickeplant instance

79 views
Skip to first unread message

JerLucid

unread,
Jan 23, 2023, 2:28:17 AM1/23/23
to AquaQ kdb+/TorQ
Hi all, really enjoying playing with TorQ lately, hope you can help me with this query

If I have 2 segmented tickerplant instances running on the same server, named stp1 and stp2, is it possible to instruct rdb1 to connect and subscribe to stp1 and rdb2 to connect and subscribe to stp2 only? 

I see in the rdb config that you can specify the tickerplant type to connect with, but I need something like tickerplant procname. 

Thanks






James Massey

unread,
Jan 26, 2023, 4:40:26 AM1/26/23
to AquaQ kdb+/TorQ

Hello,

Both RDBs and segmented tickerplants should have their own proctype and make use of TorQ's parentproctype functionality. Meaning that within your appconfig/process.csv file you should give each segmented tickerplant a new proctype, set procname as "stp1" and "stp2", and -parentproctype segmentedtickerplant. E.g.:

  • localhost,{KDBBASEPORT}+25,segmentedtickerplant2,stp2,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${TORQAPPHOME}/database.q -tplogdir ${KDBTPLOG} -parentproctype segmentedtickerplant,

You will need to make new config files each matching the new proctype you specified above within appconfig/settings. E.g.:

  • segmentedtickerplant1.q
  • segmentedtickerplant2.q

To then instruct your RDBs to subscribe to the separate tickerplants you will need to assign the new segmented tickerplant proctype to tickerplanttypes within each rdb file in appconfig/settings E.g.:

  • In rdb1.q - tickerplanttypes:`segmentedtickerplant1
  • In rdb2.q - tickerplanttypes:`segmentedtickerplant2

The alternative solution to use if it is the same replicated data flowing through both stp and rdb pairs, is to modify the rdb.q file in deploy/code/processes with the following:

  • Below line 11 add: tickerplantnames:@[value;`tickerplantnames;()]; // if your config file doesn't state tickerplantnames, then this will define it to an empty list and so the rest of the script (i.e. line 155) will act exactly as before
  • Edit line 155 (previously 154) to: if[count s:.sub.getsubscriptionhandles[tickerplanttypes;tickerplantnames;()!()];;

The function .sub.getsubscriptionhandles then takes the arguments proctype, procname and attributes. The change above allows you to specify the process name to connect to.

Your process.csv file within deploy/appconfig/process.csv will follow the below format instead:

  • localhost,{KDBBASEPORT}+24,rdb,rdb2,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,180,,${KDBCODE}/processes/rdb.q,1,,
  • localhost,{KDBBASEPORT}+25,segmentedtickerplant,stp2,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${TORQAPPHOME}/database.q -tplogdir ${KDBTPLOG},

Then create and edit each rdb file in appconfig/settings, to point to each specific stp:

  • In rdb1.q - tickerplantnames:`stp1
  • In rdb2.q - tickerplantnames:`stp2

Kind Regards,

TorQ Support

JerLucid

unread,
Feb 7, 2023, 4:29:24 AM2/7/23
to AquaQ kdb+/TorQ
Excellent, I get it now,  very clear answer too. 
I'll give that a go.
Many Thanks 

Reply all
Reply to author
Forward
0 new messages