Imagine many different sensors that send values. There is a backend where different calculations based on sensor ids and the values can be entered. These calculations are converted to siddhi apps and are deployed on the siddhi host.
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.
Is this approach correct?
Dividing the use case across multiple siddhi apps will help in maintainability. 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.