Search code examples
rkdb

How to subscribe to a KDB tickerplant from an R-client?


I want to subscribe to a KDB tickerplant from an instance of R. Specifically, every time the tickerplant receives some new data, I want to run a handler on my R-client on the newly received data.

I have already read about

  • Subscribing to a KDB tickerplant in C and Java - but these do not cover R
  • Passing data between R and KDB - but this does not cover subscribing to a tickerplant in R

So can anyone point me in the right direction or even better, have any examples?


Solution

  • As far as I know you can't do it directly in R. You can call both Java and C from R though, so it would be just a case of writing a wrapper for those. There's some simple examples here (not kdb, but same principle): http://users.stat.umn.edu/~geyer/rc/

    I haven't looked recently but someone may well have contributed code on http://code.kx.com that does this.

    The main thing is the listening loop - I'm not sure how that would work in R given you can't really start off a background thread.

    The alternative is polling, which isn't a great alternative obviously.