使用流分析生成 IoT 解决方案Build an IoT solution by using Stream Analytics


本解决方案演示如何使用 Azure 流分析从数据获得实时见解。In this solution, you learn how to use Azure Stream Analytics to get real-time insights from your data. 开发人员可以轻松地将数据流(例如点击流、日志和设备生成的事件)与历史记录或参考数据结合,从中获得业务见解。Developers can easily combine streams of data, such as click-streams, logs, and device-generated events, with historical records or reference data to derive business insights. 由世纪互联 Azure 托管的 Azure 流分析是可完全托管的实时流计算服务,它具有内置的复原性、低延迟及伸缩性,可让你在几分钟内上手。As a fully managed, real-time stream computation service that's hosted in 21Vianet Azure, Azure Stream Analytics provides built-in resiliency, low latency, and scalability to get you up and running in minutes.

完成后此解决方案,你将可以:After completing this solution, you are able to:

  • 熟悉 Azure 流分析门户。Familiarize yourself with the Azure Stream Analytics portal.
  • 配置和部署流式处理作业。Configure and deploy a streaming job.
  • 使用流分析查询语言来表达实际问题并解决这些问题。Articulate real-world problems and solve them by using the Stream Analytics query language.
  • 自信地使用流分析为客户开发流式处理解决方案。Develop streaming solutions for your customers by using Stream Analytics with confidence.
  • 使用监视和日志记录体验来排解问题。Use the monitoring and logging experience to troubleshoot issues.


若要完成本解决方案,需要满足以下先决条件:You need the following prerequisites to complete this solution:

方案简介:“你好,收费站!”Scenario introduction: "Hello, Toll!"

收费站是常见设施。A toll station is a common phenomenon. 在世界各地的许多高速公路、桥梁和隧道中都可以看到它们的身影。You encounter them on many expressways, bridges, and tunnels across the world. 每个收费站有多个收费亭。Each toll station has multiple toll booths. 在人工收费亭中,需要停车来向服务员付费。At manual booths, you stop to pay the toll to an attendant. 在自动收费亭中,位于每个收费亭顶部的传感器会在车辆通过收费亭时扫描挡风玻璃上贴附的 RFID 卡。At automated booths, a sensor on top of each booth scans an RFID card that's affixed to the windshield of your vehicle as you pass the toll booth. 我们可以轻松地将车辆通过这些收费站的情况想象成能够执行许多有趣操作的事件流。It is easy to visualize the passage of vehicles through these toll stations as an event stream over which interesting operations can be performed.


传入的数据Incoming data

本解决方案使用两个数据流。This solution works with two streams of data. 安装在收费站入口和出口处的传感器会生成第一个流。Sensors installed in the entrance and exit of the toll stations produce the first stream. 第二个流是具有车辆登记数据的静态查找数据集。The second stream is a static lookup dataset that has vehicle registration data.

入口数据流Entry data stream

入口数据流包含车辆进入收费站的相关信息。The entry data stream contains information about cars as they enter toll stations. 出口数据事件从示例应用中包含的 Web 应用实时流式传输到事件中心队列。The exit data events are live streamed into an Event Hub queue from a Web App included in the sample app.

TollIDTollID EntryTimeEntryTime 牌照LicensePlate 状态State 制造商Make 型号Model VehicleTypeVehicleType VehicleWeightVehicleWeight 收费站Toll 标记Tag
11 2014-09-10 12:01:00.0002014-09-10 12:01:00.000 JNB 7001JNB 7001 NYNY HondaHonda CRVCRV 11 00 77
11 2014-09-10 12:02:00.0002014-09-10 12:02:00.000 YXZ 1001YXZ 1001 NYNY ToyotaToyota CamryCamry 11 00 44 123456789123456789
33 2014-09-10 12:02:00.0002014-09-10 12:02:00.000 ABC 1004ABC 1004 CTCT FordFord TaurusTaurus 11 00 55 456789123456789123
22 2014-09-10 12:03:00.0002014-09-10 12:03:00.000 XYZ 1003XYZ 1003 CTCT ToyotaToyota CorollaCorolla 11 00 44
11 2014-09-10 12:03:00.0002014-09-10 12:03:00.000 BNJ 1007BNJ 1007 NYNY HondaHonda CRVCRV 11 00 55 789123456789123456
22 2014-09-10 12:05:00.0002014-09-10 12:05:00.000 CDE 1007CDE 1007 NJNJ ToyotaToyota 4x44x4 11 00 66 321987654321987654

下面是每个列的简短说明:Here is a short description of the columns:

Column 说明Description
TollIDTollID 唯一标识收费亭的收费亭 IDThe toll booth ID that uniquely identifies a toll booth
EntryTimeEntryTime 车辆进入收费亭的日期和时间(世界协调时)The date and time of entry of the vehicle to the toll booth in UTC
牌照LicensePlate 车辆的牌照号码The license plate number of the vehicle
状态State 美国的某个州A state in United States
制造商Make 汽车制造商The manufacturer of the automobile
型号Model 车辆的型号The model number of the automobile
VehicleTypeVehicleType 1 代表客车,2 代表商用车Either 1 for passenger vehicles or 2 for commercial vehicles
WeightTypeWeightType 汽车的重量,单位为吨;0 代表客车Vehicle weight in tons; 0 for passenger vehicles
收费站Toll 通行费,单位为美元The toll value in USD
标记Tag 车辆上可用于自动付费的电子标签;空白代表手动付费The e-Tag on the automobile that automates payment; blank where the payment was done manually

出口数据流Exit data stream

出口数据流包含车辆离开收费站的相关信息。The exit data stream contains information about cars leaving the toll station. 出口数据事件从示例应用中包含的 Web 应用实时流式传输到事件中心队列。The exit data events are live streamed into an Event Hub queue from a Web App included in the sample app.

TollIdTollId ExitTimeExitTime LicensePlateLicensePlate
11 2014-09-10T12:03:00.0000000Z2014-09-10T12:03:00.0000000Z JNB 7001JNB 7001
11 2014-09-10T12:03:00.0000000Z2014-09-10T12:03:00.0000000Z YXZ 1001YXZ 1001
33 2014-09-10T12:04:00.0000000Z2014-09-10T12:04:00.0000000Z ABC 1004ABC 1004
22 2014-09-10T12:07:00.0000000Z2014-09-10T12:07:00.0000000Z XYZ 1003XYZ 1003
11 2014-09-10T12:08:00.0000000Z2014-09-10T12:08:00.0000000Z BNJ 1007BNJ 1007
22 2014-09-10T12:07:00.0000000Z2014-09-10T12:07:00.0000000Z CDE 1007CDE 1007

下面是每个列的简短说明:Here is a short description of the columns:

Column 说明Description
TollIDTollID 唯一标识收费亭的收费亭 IDThe toll booth ID that uniquely identifies a toll booth
ExitTimeExitTime 车辆离开收费亭的日期和时间(世界协调时)The date and time of exit of the vehicle from toll booth in UTC
LicensePlateLicensePlate 车辆的牌照号码The license plate number of the vehicle

商用车登记数据Commercial vehicle registration data

本解决方案使用商用车注册数据库的静态快照。The solution uses a static snapshot of a commercial vehicle registration database. 此数据作为 JSON 文件保存到示例随附的 Azure Blob 存储中。This data is saved as a JSON file into Azure blob storage, included in the sample.

牌照LicensePlate RegistrationIdRegistrationId ExpiredExpired
SVT 6023SVT 6023 285429838285429838 11
XLZ 3463XLZ 3463 362715656362715656 00
BAC 1005BAC 1005 876133137876133137 11
RIV 8632RIV 8632 992711956992711956 00
SNY 7188SNY 7188 592133890592133890 00
ELH 9896ELH 9896 678427724678427724 11

下面是每个列的简短说明:Here is a short description of the columns:

Column 说明Description
牌照LicensePlate 汽车的牌照号码The license plate number of the vehicle
RegistrationIdRegistrationId 车辆的登记 IDThe vehicle's registration ID
ExpiredExpired 车辆的注册状态:0 代表车辆注册仍有效,1 代表车辆注册已过期The registration status of the vehicle: 0 if vehicle registration is active, 1 if registration is expired

设置 Azure 流分析的环境Set up the environment for Azure Stream Analytics

若要完成本解决方案,需要一个 Azure 订阅。To complete this solution, you need a Azure subscription. 如果没有 Azure 帐户,可以请求试用版If you do not have an Azure account, you can request a trial version.

请务必按照本文末尾的“清理 Azure 帐户”部分中的步骤操作,以便充分利用 Azure 信用额度。Be sure to follow the steps in the "Clean up your Azure account" section at the end of this article so that you can make the best use of your Azure credit.

部署示例Deploy the sample

只需单击几下鼠标,就能轻松将多个资源一起部署在某个资源组中。There are several resources that can easily be deployed in a resource group together with a few clicks. 解决方案定义托管在 https://github.com/Azure/azure-stream-analytics/tree/master/Samples/TollApp 上的 github 存储库中。The solution definition is hosted in github repository at https://github.com/Azure/azure-stream-analytics/tree/master/Samples/TollApp.

在 Azure 门户中部署 TollApp 模板Deploy the TollApp template in the Azure portal

  1. 若要将 TollApp 环境部署到 Azure,请使用此链接部署 TollApp Azure 模板To deploy the TollApp environment to Azure, use this link to Deploy TollApp Azure Template.

  2. 根据提示登录到 Azure 门户。Sign in to the Azure portal if prompted.

  3. 选择要对其中各种资源计费的订阅。Choose the subscription in which the various resources are billed.

  4. 指定具有唯一名称的新资源组,例如 MyTollBoothSpecify a new resource group, with a unique name, for example MyTollBooth.

  5. 选择 Azure 位置。Select an Azure location.

  6. 在“间隔”中指定若干秒。Specify an Interval as a number of seconds. 此值将在示例 Web 应用中使用,指定将数据发送到事件中心的频率。This value is used in the sample web app, for how frequently to send data into Event Hub.

  7. 选中表示同意条款和条件的复选框。Check to agree to the terms and conditions.

  8. 选择“固定到仪表板”,以便稍后可以轻松找到资源。Select Pin to dashboard so that you can easily locate the resources later on.

  9. 选择“购买”以部署示例模板。Select Purchase to deploy the sample template.

  10. 片刻之后,将会显示一条通知来确认部署成功After a few moments, a notification appears to confirm the Deployment succeeded.

查看 Azure 流分析 TollApp 资源Review the Azure Stream Analytics TollApp resources

  1. 登录到 Azure 门户Log in to the Azure portal

  2. 找到在上一部分命名的资源组。Locate the Resource Group that you named in the previous section.

  3. 检查该资源组中是否列出了以下资源:Verify that the following resources are listed in the resource group:

    • 一个 Cosmos DB 帐户One Cosmos DB Account
    • 一个 Azure 流分析作业One Azure Stream Analytics Job
    • 一个 Azure 存储帐户One Azure Storage Account
    • 一个 Azure 事件中心One Azure Event Hub
    • 两个 Web 应用Two Web Apps

检查示例 TollApp 作业Examine the sample TollApp job

  1. 从上一部分创建的资源组着手,选择以名称 tollapp 开头的流分析流式处理作业(名称包含随机字符,以确保唯一性)。Starting from the resource group in the previous section, select the Stream Analytics streaming job starting with the name tollapp (name contains random characters for uniqueness).

  2. 在该作业的“概述”页上,观察“查询”框以查看查询语法。On the Overview page of the job, notice the Query box to view the query syntax.

    SELECT TollId, System.Timestamp AS WindowEnd, COUNT(*) AS Count
    INTO CosmosDB
    FROM EntryStream TIMESTAMP BY EntryTime
    GROUP BY TUMBLINGWINDOW(minute, 3), TollId

    为了解释查询的意图,我们假设需要统计进入某个收费亭的汽车数目。To paraphrase the intent of the query, let's say that you need to count the number of vehicles that enter a toll booth. 由于进入高速公路收费亭的车流是连续性的,这些入口事件类似于永不停止的流。Because a highway toll booth has a continuous stream of vehicles entering, those are entrance events are analogous to a stream that never stops. 若要量化流,必须定义要不断度量的“时间段”。To quantify the stream, you have to define a "period of time" to measure over. 我们进一步将问题具体化为“每三分钟有多少汽车进入收费亭?”Let's refine the question further, to "How many vehicles enter a toll booth every three minutes?" 这通常称为轮转计数。This is commonly referred to as the tumbling count.

    如你所见,Azure 流分析会使用类似 SQL 的查询语言,并添加几个扩展来指定与时间相关的查询方面。As you can see, Azure Stream Analytics uses a query language that's like SQL and adds a few extensions to specify time-related aspects of the query. 有关详细信息,请参阅时间管理和查询中所用的开窗构造。For more details, read about Time Management and Windowing constructs used in the query.

  3. 检查 TollApp 示例作业的输入。Examine the Inputs of the TollApp sample job. 当前查询中仅使用了 EntryStream 输入。Only the EntryStream input is used in the current query.

    • EntryStream 输入是一个事件中心连接,它将代表每次汽车进入高速公路收费亭的事件数据排队。EntryStream input is an Event Hub connection that queues data representing each time a car enters a tollbooth on the highway. 示例中包含的 Web 应用将会创建事件,而这些数据将在此事件中心排队。A web app that is part of the sample is creating the events, and that data is queued in this Event Hub. 请注意,此输入在流式处理查询的 FROM 子句中查询。Note that this input is queried in the FROM clause of the streaming query.
    • ExitStream 输入是一个事件中心连接,它将代表每次汽车离开高速公路收费亭的事件数据排队。ExitStream input is an Event Hub connection that queues data representing each time a car exits a tollbooth on the highway. 此流输入在稍后的查询语法变体中使用。This streaming input is used in later variations of the query syntax.
    • Registration 输入是一个 Azure Blob 存储连接,指向按需用于查找的静态 registration.json 文件。Registration input is an Azure Blob storage connection, pointing to a static registration.json file, used for lookups as needed. 此参考数据输入在稍后的查询语法变体中使用。This reference data input is used in later variations of the query syntax.
  4. 检查 TollApp 示例作业的输出。Examine the Outputs of the TollApp sample job.

    • Cosmos DB 输出是接收输出接收器事件的 Cosmos 数据库集合。Cosmos DB output is a Cosmos database collection that receives the output sink events. 请注意,此输出在流式处理查询的 INTO 子句中使用。Note that this output is used in INTO clause of the streaming query.

启动 TollApp 流式处理作业Start the TollApp streaming job

遵循以下步骤启动流式处理作业:Follow these steps to start the streaming job:

  1. 在作业的“概述”页上选择“启动”。On the Overview page of the job, select Start.

  2. 在“启动作业”窗格中选择“立即”。On the Start job pane, select Now.

  3. 等待片刻,作业运行后,请在流式处理作业的“概述”页上查看“监视”图表。After a few moments, once the job is running, on the Overview page of the streaming job, view the Monitoring graph. 此图应显示数千个输入事件和数十个输出事件。The graph should show several thousand input events, and tens of output events.

查看 CosmosDB 输出数据Review the CosmosDB output data

  1. 找到包含 TollApp 资源的资源组。Locate the resource group that contains the TollApp resources.

  2. 选择名称模式为 tollapp-cosmos 的 Azure Cosmos DB 帐户。Select the Azure Cosmos DB Account with the name pattern tollapp-cosmos.

  3. 选择“数据资源管理器”标题打开“数据资源管理器”页。Select the Data Explorer heading to open the Data Explorer page.

  4. 展开“tollAppDatabase” > “tollAppCollection” > “文档”。Expand the tollAppDatabase > tollAppCollection > Documents.

  5. 提供输出后,ID 列表中会显示多个文档。In the list of ids, several docs are shown once the output is available.

  6. 选择每个 ID 以查看 JSON 文档。Select each id to review the JSON document. 请注意每个 tollid、windowend 时间和该时限内的汽车计数。Notice each tollid, windowend time, and the count of cars from that window.

  7. 再过三分钟后,将显示另外四个文档,每个 tollid 对应一个文档。After an additional three minutes, another set of four documents is available, one document per tollid.

报告每辆汽车的总时间Report total time for each car

一辆车通过收费亭所需的平均时间可帮助评估流程的效率和客户体验。The average time that's required for a car to pass through the toll helps to assess the efficiency of the process and the customer experience.

要得出总时间,请将 EntryTime 流与 ExitTime 流相联接。To find the total time, join the EntryTime stream with the ExitTime stream. 在等量匹配的 TollId 和 LicencePlate 列中联接两个输入流。Join the two input streams on the equal matching TollId and LicencePlate columns. JOIN 运算符要求指定弹性时间,说明联接事件之间可接受的时间差。The JOIN operator requires you to specify temporal leeway that describes the acceptable time difference between the joined events. 使用 DATEDIFF 函数指定事件之间的时间差不能超过 15 分钟。Use the DATEDIFF function to specify that events should be no more than 15 minutes from each other. 另外,将 DATEDIFF 函数应用到出口及入口时间,以计算汽车经过收费站的实际时间。Also apply the DATEDIFF function to exit and entry times to compute the actual time that a car spends in the toll station. 请注意相比 JOIN 条件,在 SELECT 语句中使用 DATEDIFF 的差异。Note the difference of the use of DATEDIFF when it's used in a SELECT statement rather than a JOIN condition.

SELECT EntryStream.TollId, EntryStream.EntryTime, ExitStream.ExitTime, EntryStream.LicensePlate, DATEDIFF (minute, EntryStream.EntryTime, ExitStream.ExitTime) AS DurationInMinutes
FROM EntryStream TIMESTAMP BY EntryTime
ON (EntryStream.TollId= ExitStream.TollId AND EntryStream.LicensePlate = ExitStream.LicensePlate)
AND DATEDIFF (minute, EntryStream, ExitStream ) BETWEEN 0 AND 15

更新 TollApp 流式处理作业查询语法:To update the TollApp streaming job query syntax:

  1. 在作业的“概述”页上选择“停止”。On the Overview page of the job, select Stop.

  2. 片刻之后,将出现作业已停止的通知。Wait a few moments for the notification that the job has stopped.

  3. 在“作业拓扑”标题下,选择“< > 查询”Under the JOB TOPOLOGY heading, select < > Query

  4. 粘贴调整后的流式处理 SQL 查询。Paste the adjusted streaming SQL query.

  5. 选择“保存”以保存查询。Select Save to save the query. 选择“是”确认保存更改。Confirm Yes to save the changes.

  6. 在作业的“概述”页上选择“启动”。On the Overview page of the job, select Start.

  7. 在“启动作业”窗格中选择“立即”。On the Start job pane, select Now.

查看输出中的总时间Review the total time in the output

重复前一部分所述的步骤,查看流式处理作业返回的 CosmosDB 输出数据。Repeat the steps in the preceding section to review the CosmosDB output data from the streaming job. 查看最新的 JSON 文档。Review the latest JSON documents.

例如,以下文档显示了某辆示例汽车的特定牌照、entrytime 和 exittime,以及 DATEDIFF 计算的 durationinminutes 字段(显示该汽车在收费亭停留了两分钟):For example, this document shows an example car with a certain license plate, the entrytime and exit time, and the DATEDIFF calculated durationinminutes field showing the toll booth duration as two minutes:

    "tollid": 4,
    "entrytime": "2018-04-05T06:51:39.0491173Z",
    "exittime": "2018-04-05T06:53:09.0491173Z",
    "licenseplate": "JVR 9425",
    "durationinminutes": 2,
    "id": "ff52eb25-d580-7566-2879-1f52bba6601e",
    "_rid": "+8E4AI1DZgBjAAAAAAAAAA==",
    "_self": "dbs/+8E4AA==/colls/+8E4AI1DZgA=/docs/+8E4AI1DZgBjAAAAAAAAAA==/",
    "_etag": "\"ad02f6b8-0000-0000-0000-5ac5c8330000\"",
    "_attachments": "attachments/",
    "_ts": 1522911283

报告注册已过期的汽车Report vehicles with expired registration

Azure 流分析可以使用参考数据静态快照来与时态数据流联接。Azure Stream Analytics can use static snapshots of reference data to join with temporal data streams. 若要演示此功能,请使用以下示例问题。To demonstrate this capability, use the following sample question. Registration 输入是一个静态 blob json 文件,其中列出牌照过期时间。The Registration input is a static blob json file that lists the expirations of license tags. 基于牌照执行联接,可将参考数据与通过收费亭的每辆汽车进行比较。By joining on the license plate, the reference data is compared to each vehicle passing through the toll both.

如果某辆商用车已向收费公司登记,则可以直接通过收费亭,而不用停车接受检查。If a commercial vehicle is registered with the toll company, it can pass through the toll booth without being stopped for inspection. 使用注册查找表来识别注册已过期的所有商用车。Use the registration lookup table to identify all commercial vehicles that have expired registrations.

SELECT EntryStream.EntryTime, EntryStream.LicensePlate, EntryStream.TollId, Registration.RegistrationId
FROM EntryStream TIMESTAMP BY EntryTime
JOIN Registration
ON EntryStream.LicensePlate = Registration.LicensePlate
WHERE Registration.Expired = '1'
  1. 重复前一部分所述的步骤,更新 TollApp 流式处理作业查询语法。Repeat the steps in the preceding section to update the TollApp streaming job query syntax.

  2. 重复前一部分所述的步骤,查看流式处理作业返回的 CosmosDB 输出数据。Repeat the steps in the preceding section to review the CosmosDB output data from the streaming job.

示例输出:Example output:

        "entrytime": "2018-04-05T08:01:28.0252168Z",
        "licenseplate": "GMT 3221",
        "tollid": 1,
        "registrationid": "763220582",
        "id": "47db0535-9716-4eb2-db58-de7886966cbf",
        "_rid": "y+F8AJ9QWACSAQAAAAAAAA==",
        "_self": "dbs/y+F8AA==/colls/y+F8AJ9QWAA=/docs/y+F8AJ9QWACSAQAAAAAAAA==/",
        "_etag": "\"88007d8d-0000-0000-0000-5ac5d7e20000\"",
        "_attachments": "attachments/",
        "_ts": 1522915298

横向扩展作业Scale out the job

Azure 流分析可弹性缩放,因而能够处理大量数据。Azure Stream Analytics is designed to elastically scale so that it can handle large volumes of data. Azure 流分析查询可以使用 PARTITION BY 子句来告诉系统此步骤会横向扩展。PartitionId 是系统加入以与输入(事件中心)的分区 ID 匹配的特殊列。The Azure Stream Analytics query can use a PARTITION BY clause to tell the system that this step scales out. PartitionId is a special column that the system adds to match the partition ID of the input (event hub).

若要横向扩展对分区的查询,请将查询语法编辑为以下代码:To scale out the query to partitions, edit the query syntax to the following code:

SELECT TollId, System.Timestamp AS WindowEnd, COUNT(*)AS Count
FROM EntryStream 
GROUP BY TUMBLINGWINDOW(minute,3), TollId, PartitionId

将流式处理作业纵向扩展为更多的流单元:To scale up the streaming job to more streaming units:

  1. 停止当前作业。Stop the current job.

  2. 在“< > 查询”页中更新查询语法,然后保存更改。Update the query syntax in the < > Query page, and save the changes.

  3. 在流式处理作业的“配置”标题下,选择“缩放”。Under the CONFIGURE heading on the streaming job, select Scale.

  4. 将“流单元”滑块从 1 滑到 6。Slide the Streaming units slider from 1 to 6. 流单元定义作业能够接收的计算能力大小。Streaming units define the amount of compute power that the job can receive. 选择“其他安全性验证” 。Select Save.

  5. 启动流式处理作业,以演示其他缩放操作。Start the streaming job to demonstrate the additional scale. Azure 流分析可在更多的计算资源之间分配工作,并可以使用 PARTITION BY 子句中指定的列将不同资源中的工作分区,从而提高吞吐量。Azure Stream Analytics distributes work across more compute resources and achieve better throughput, partitioning the work across resources using the column designated in the PARTITION BY clause.

监视作业Monitor the job

“监视器”区域包含正在运行的作业的相关统计信息。The MONITOR area contains statistics about the running job. 需要完成首次配置,才能使用同一区域中的存储帐户(按本文档其余部分命名收费站)。First-time configuration is needed to use the storage account in the same region (name toll like the rest of this document).

Azure 流分析作业监视

还可通过作业仪表板的“设置”区域访问“活动日志”。You can access Activity Logs from the job dashboard Settings area as well.

清理 TollApp 资源Clean up the TollApp resources

  1. 在 Azure 门户中停止流分析作业。Stop the Stream Analytics job in the Azure portal.

  2. 找到包含与 TollApp 模板相关的八个资源的资源组。Locate the resource group that contains eight resources related to the TollApp template.

  3. 选择“删除资源组”。Select Delete resource group. 键入资源组名称以确认删除。Type the name of the resource group to confirm deletion.


本解决方案介绍了 Azure 流分析服务。This solution introduced you to the Azure Stream Analytics service. 其中演示如何为流分析作业配置输入和输出。It demonstrated how to configure inputs and outputs for the Stream Analytics job. 本解决方案还使用收费站数据场景来解释在数据空间不断变化时所引发的常见问题类型,以及如何在 Azure 流分析中使用类似于 SQL 的简单查询来解决这些问题。Using the Toll Data scenario, the solution explained common types of problems that arise in the space of data in motion and how they can be solved with simple SQL-like queries in Azure Stream Analytics. 本解决方案介绍了用于处理时态数据的 SQL 扩展构造。The solution described SQL extension constructs for working with temporal data. 其中说明如何联接不同的数据流、如何使用静态参考数据来扩充数据流,以及如何扩大查询来获得更高的吞吐量。It showed how to join data streams, how to enrich the data stream with static reference data, and how to scale out a query to achieve higher throughput.

尽管本解决方案提供了详细介绍,但它不可能面面俱到。Although this solution provides a good introduction, it is not complete by any means. 可通过在常用流分析使用模式的查询示例中使用 SAQL 语言,发现更多查询模式。You can find more query patterns using the SAQL language at Query examples for common Stream Analytics usage patterns.