【发布时间】:2021-02-07 07:28:41
【问题描述】:
我正在尝试在 kdb-tick 系统中实现动态订阅者,从而根据消费者提供的查询将事件的子集传递给给定的消费者。
例如给定一批事件,即:
flip `source`channel`value!(10?`a`b`c;10?`a`b`c;10?10)
source channel value
--------------------
a a 4
b b 5
a c 4
b a 2
c c 7
c b 8
c a 5
a c 6
b a 4
b a 1
tickerplant 应该只发送没有`c i.e.通道的事件
source channel value
--------------------
a a 4
b b 5
b a 2
c b 8
c a 5
b a 4
b a 1
我试图通过解析如下动态条件来实现这一点:
q).tp.subscribers
hp | host isOpen port h subs
----------| --------------------------------------------------
:test:5000| test 0 5000 6 "enlist(not;(in;`channel;enlist`c))"
其中 subs 是功能选择语句的条件参数,用于以下代码:
.tp.send:{neg[x] y};
.tp.reval:{[batch;subscriber]
.tp.send[raze .subscriber`h] reval[parse["?[batch;",raze[subscriber`subs],";0b;()]"]]
};
// Called with event batch
.tp.broadcast:{[batch]
.tp.reval[batch]'[select from .tp.subscribers where isOpen]
};
由于批处理无法通过功能选择语句在非全局上下文中寻址而失败。 我想知道如何有效地实现此功能?
谁能给我建议或指出与此问题陈述的解决方案有关的信息。 您的建议将不胜感激。 抱歉,如果这是一个新手问题。 谢谢
【问题讨论】:
标签: kdb