简体   繁体   English

WSO2SP:处理不同计算的正确方法是什么?

[英]WSO2SP: What is the correct way to handle different calculations?

Imagine many different sensors that send values. 想象一下许多发送值的传感器。 There is a backend where different calculations based on sensor ids and the values can be entered. 在后端,可以输入基于传感器ID和值的不同计算。 These calculations are converted to siddhi apps and are deployed on the siddhi host. 这些计算将转换为siddhi应用程序,并部署在siddhi主机上。

Is the approach correct to create a own application for each single calculation? 为每个单独的计算创建自己的应用程序的方法正确吗?

Example

from a=SpeedStream[a.id == "s1"], b=SpeedStream[b.id == "s1"]
select b.speed-a.speed as acceleration
insert into AccelerationStream

Its possible that the same calculation would be deployed multiple times, where only the a.id and b.id differ. 可能会多次部署同一计算,而只有a.idb.id不同。

Is this approach correct? 这种方法正确吗?

Dividing the use case across multiple siddhi apps will help in maintainability. 将用例划分为多个siddhi应用程序将有助于可维护性。 it can sometimes cause the same query to be deployed multiple times and it is fine. 它有时可能导致同一查询多次部署,这很好。

Although I would advise having filters on the start of the pipeline to filter out only the events that need to be processed, to improve efficiency. 尽管我建议在管道的开始处使用过滤器,以仅过滤出需要处理的事件,以提高效率。

from SpeedStream[id == "s1"] 
select *
insert into FilteredSpeedStream;

Now, FilteredSpeedStream can be used in later queries, without the filter, FilteredSpeedStream will have only the events for one sensor type, thus making the pipeline efficient. 现在,FilteredSpeedStream可以在以后的查询中使用,而无需过滤器,FilteredSpeedStream将仅具有一种传感器类型的事件,从而使管道高效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM