qJava and Publisher

I’m trying to run the publisher posted on

https://github.com/exxeleron/qJava/blob/master/src/sample/java/Publisher.java

and I’m getting a very generic error

Press <ENTER> to close application
com.exxeleron.qjava.QException: .u.upd
    at com.exxeleron.qjava.QReader.readError(QReader.java:409)
    at com.exxeleron.qjava.QReader.readObject(QReader.java:189)
    at com.exxeleron.qjava.QReader.read(QReader.java:99)
    at com.exxeleron.qjava.QBasicConnection.sync(QBasicConnection.java:159)
    at PublisherTask.run(Publisher.java:74)
    at java.lang.Thread.run(Thread.java:744)

Anyone seen this? I wish there it has more detail. My Q connection is running on port 5001 and seems to be functioning.

it probably expects the remote process to have the function .u.upd defined, which publishes the data to subcribers.

See

http://code.kx.com/wiki/Startingkdbplus/tick

To get you going, and just print the received data on the kdb+ console, define it as

q).u.upd:{0N!(x;y);}

That worked! Just a follow up question. Since the ticker subscriber is too complicated for what I want to do, how would you define the u.upd function to write to disk every time it’s called. My file is

q)select from `:dsPricing

id date open close high low volume

Thanks.

if you have no symbols in the data, then upsert to the splayed table

.u.upd:{`:dsPricing/ upsert y;}

but this is not suitable for frequent updates; for that you should append in memory, and flush to disk at suitable intervals - e.g. 30 seconds.