我已经设置了2个节点工作程序和1个节点管理程序siddhi集群。 以下是我尝试推送到经理的查询。当查询中没有任何联接时,一切似乎都正常运行,但是,如下所述,如果联接发生,查询将部署在工作程序节点中,但事件似乎无法得到满足。
_layout.cshtml
事件正在传递
@app:name("rule_1")
@source(
type="kafka",
topic.list="test-input-topic",
group.id="test-group",
threading.option="single.thread",
bootstrap.servers="localhost:9092",
@Map(type="json"))
define stream TempStream (deviceID string,roomNo string,temp int );
@sink(
type="kafka",
topic="test-output-topic",
bootstrap.servers="localhost:9092",
@Map(type="json"))
define stream OutStream (message string, message1 string, message2 double);
@info(name = "query1")
@dist(execGroup="group1")
from TempStream[deviceID=="rule_1" and temp>10]#window.time(5 sec)
select avg(temp) as avgTemp, roomNo, deviceID
insert all events into AvgTempStream1;
@info(name = "query2")
@dist(execGroup="group2")
from TempStream[deviceID=="rule_1" and temp<10]#window.time(5 sec)
select avg(temp) as avgTemp, roomNo, deviceID
insert all events into AvgTempStream2;
@info(name = "query3")
@dist(execGroup="group3")
from AvgTempStream1#window.length(1) as stream1 join AvgTempStream2#window.length(1) as stream2
select stream1.deviceID as message,stream1.roomNo as message1, stream1.avgTemp as message2
having stream1.avgTemp>stream2.avgTemp
insert into outputStream;
@info(name = "query4")
@dist(execGroup="group4")
from AvgTempStream1[deviceID=="rule_1"]
select deviceID as message, roomNo as message1, avgTemp as message2
insert into OutStream;
答案 0 :(得分:1)
根据上述给定的Siddhi应用程序,您将需要发送两个输入事件以使其输出。一个事件的温度> 10,其他温度<10。例如:
{"event":{"deviceID":"rule_1","roomNo":"123","temp":12}}
{"event":{"deviceID":"rule_1","roomNo":"123","temp":8}}
这将确保发生联接并发出事件。出于故障排除的目的,您可以使用Kafka使用者订阅不确定的Kafka主题。中间主题的名称将遵循SiddhiAppName.StreamName的格式。例如:rule_1.AvgTempStream1
希望这会有所帮助!
谢谢, 提山