Reputation: 93
I have a tickerplant set up but I need to log every minute the subscription details of subscribers (the table and the syms they are listening to).
I am aware of the .z.ts function and the fact that the correct function should have \t 60000 before the code.
Is there a simple way of publishing the subscription details of subscribers every minute?
Upvotes: 0
Views: 431
Reputation: 567
You may consider taking a different approach. The changes to subscription details are essentially state changes that are triggered by specific events - calls to sub or add, disconnects, and maybe you have some self-defined events like unsub.
You could modify or wrap these functions and events with logic that records the state changes at that time.
Upvotes: 1
Reputation: 13582
If your tickerplant works in non-batched mode (meaning you don't specify a timer on the command line on startup) then all you would need to do is modify the .z.ts
function - which is normally .z.ts:{ts .z.D}
- to also publish a table of stored data on subscribers, either by pushing realtime records downstream or writing them to file. This table would be populated using either .z.po
(user connected) or .u.sub
(user initiated subscription) and modified when a user disconnects (.z.pc
). Ideas on how to capture user info can be found here: https://code.kx.com/q/cookbook/using-dotz/#trackclientsq
If you want it to be published downstream rather than written to file you would need to set this table up as an additional subscribe-able table in .u.w
in order to manage who subscribes to this new table.
If you're using the vanilla tickerplant code from Kx as the base for your tickerplant then by default the non-batched mode sets the timer to be 1 second but you could change that to 1 minute, however this would mean that your end-of-day trigger could be up to a minute late. This may not be a big deal.
If you're using batched mode and it isn't a one-minute timer then it would be trickier because you'd have to have one timer managing the batch publishing and one timer managing the minutely publish of subscription info. It can be done but it starts to get messy at that point
Upvotes: 3