使用Azure流分析进行资产跟踪 [英] Asset Tracking with Azure Stream Analytics
问题描述
我有一个事件中心和一个将数据发送到Power BI的流分析作业.我想知道配置事件中心/资产跟踪的最佳方法是什么?
I have an event Hub and a stream analytics job sending data to Power BI. I was wondering what would be the best way to configure the event hub / for asset tracking?
例如,我有多个客户端发送到事件中心->流分析作业,并且我希望能够确定具有特定ID的客户端是否离线?
e.g I have multiple clients sending to the event hub -> stream analytic job and I want to be able to determine if a client with a particular ID goes offline?
干杯!
推荐答案
如果ID列表相对静态,则可以使用引用数据连接输出每个时间窗口中缺少的所有ID.
If the list of IDs is relatively static, then you can use reference data join to output all IDs that are missing in each time window.
如果要从流本身推断ID,并且要检测何时在前一个窗口中激活的ID在当前窗口中未激活,则可以使用流联接.这是一个例子
If you want to infer the IDs from the stream itself, and want to detect when an ID that was active in previous window is not active in current window, you can use stream join. Here is an example
with MissingAssets as
(
select
PreviousWindowSignal.signalTime,
PreviousWindowSignal.AssetId
from
AssetSignalStream PreviousWindowSignal Timestamp by signalTime
left outer join
AssetSignalStream CurrentWindowSignal Timestamp by signalTime
on
PreviousWindowSignal.AssetId = CurrentWindowSignal.AssetId
and datediff(second,PreviousWindowSignal,CurrentWindowSignal) between 1 and 300
where
CurrentWindowSignal.AssetId is null
)
select
AssetId,
max(signalTime) MostRecentSignalInWindow
from
MissingAssets
group by
AssetId,
TumblingWindow(ss,300)
这篇关于使用Azure流分析进行资产跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!