问题
I'm new to Azure and to analytics. I'm trying to understand streaming alert rules engine. I have used some sample data as input and have queries to filter data. However i'm not sure of what rules engine means, is it just queries or is there anything more to it and is there a way we can have all rules in one if yes, how?
回答1:
The main way to define logic for ASA is to use SQL, which provide a way to define rules with SQL statements (e.g. SELECT DeviceID ... WHERE temperature>50). Multiple conditions can be used in the same query and multiple queries can be defined in the same job. This approach is pretty flexible, however the rules themselves need to be defined before the job start since ASA will compile the job. See here for some common query patterns.
Then, when we talk about rule engine, users often require more dynamicity of the rules. In order to provide this dynamicity, it is possible to dynamically inject rule conditions, or even full rules to a running job (the later one is for advanced users). Below some detailed info:
- Dynamically configure threshold rules using reference data: ASA can use reference data to get the latest conditions. See more details in this blog post
- Dynamically inject rules using JavaScript UDF (this is more advanced): users can create a new function using JavaScript Function using code snippets coming from reference data. Such technique is used by Azure Remote Monitoring microservices (see here on GitHub).
Let me know if you have any further question and how we can improve.
Thanks,
JS (Azure Stream Analytics)
来源:https://stackoverflow.com/questions/53045444/rules-engine-for-stream-analytics-on-azure