Publishing Data After Upd

Greetings Qbies, 
I have a process, running on its own port,  listening to my tickerplant and running some computations during .u.upd. 

I’m hoping to publish the updated results such that I’ll be able to listen from c#. 

When I go to publish via 

.u.pub[tablename; select [-1] from tablename];

I get a `.u.pub error. 

I’m able to access the table through the q process window without issue. Unsure why it wont publish.

THanks!

A couple of questions:

  1. Does your instance actually have the pub functionality (u.q) loaded? It looks like you don’t have .u.pub defined

  2. Is the tableName you’re publishing in .u.t (and thus .u.w)?

  3. Is your tableName variable a symbol (type -11h)?

  4. Does your c# subscriber show up in .u.w?

If you can answer yes to all four then in theory it should work

Terry

Hey, Terry. Thanks!

I was not loading u.q. 

This is what I’m working with(I’ve stripped it to the bones for convenience): 

\l tick/u.q

     

sym:get `:c:/q/start/tick/sym;

t:`trades;         

h:hopen `::5000;       

if[x~“RandomProcessName”; 

 upd:{[t;data];

  `table insert response;

  

  RandomFunction;

  .u.pub[table;select [-1] from table];

  };

 .u.end:{};

 ]

{h(“.u.sub”;x;s)} each t;

(new Groups isn’t letting me insert as code)

When I go to listen, I initially see a “t" error come through the q console. It then shows a "w” with each update that comes through the tickerplant. 

Thanks!

After working through what you said above, I’ve gotten to the following error: 

'FinalTable

tick\u.q:15: .u.sub:{if[x~`;:sub[;y]each t];if[not x in t;'x];del.z.w;add[x;y]}

 

You seem to have a lot of variables floating around. 

What happened to “t” and “data” in your upd function? You’re not using them. Where does “response” come from? What is “table”? What is “finalTable”?

Your last error is because `finalTable isn’t in .u.t (you can’t publish a table that isn’t in .u.t/.u.w and similarly a user can’t subscribe to a table that isn’t in .u.t/.u.w). 

Terry

I suggest subscribing to every table from the tickerplant instead to get subscription working:

\l tick/u.q
sym:get :c:/q/start/tick/sym;<br> h:hopen ::5000;
upd:{[t;data];
t insert data;
RandomFunction;
.u.pub[t;-1#t]; // or publish whatever tablename and table you want
};
.u.end:{ @[`.;t;:;{0#get x} each t:tables]; }; // good idea to flush tables
h(`.u.sub;`;s)

Once process is up and running, you can decide which tables to keep and subscribe to

Does it matter if the table I’m trying to sub to, through the C#, is local to that process alone? 

Yeah that’s ok, you can have a table local to that process alone and pushed downstream to your subscribers - you just need to ensure the table name you’re publishing under is in .u.t/.u.w. Which you can generally do by defining your table schema prior to loading u.q

Terry

Ah, I got it. Thanks for the help!