仅在需要时根据时间戳更新CosmosDB [英] Only update in CosmosDB when needed based on timestamp

查看:98
本文介绍了仅在需要时根据时间戳更新CosmosDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我有一个使用Azure IoT Hub + Stream Analytics + CosomosDB的用例,肯定很多Azure用户都有,但我无法解决它使用当前的流分析功能。

I have a use case using Azure IoT Hub + Stream Analytics + CosomosDB that for sure a lot of Azure Users have but I'm NOT being able to solve it using current Stream Analytics functionality.

我们有大量设备将JSON数据发送到IoT HUB,例如同一房间的温度。此数据通过Stream Analytics将所有数据保存在CosmosDB中。对于我们来说,非常重要的是快速,快速地为每个房间提供最新的
数据。例如cosmosdb中的Collection,其中包含每个房间的最新信息。在房间里可以是1 .. N设备

We have plenty of devices that send JSON data to IoT HUB, for example the temperature for the same room. This data passes through Stream Analytics to save all of them in CosmosDB. For us is very important to have them in a quick and fast way the most update data for each room. For example a Collection in cosmosdb with the LATEST information of every room. In the room can be 1 .. N Devices

我们的问题是设备离线生成带有我们传感器时间戳的数据离线方式。当设备同步到IoT时,将发送房间的所有传感器数据。我们只希望将这些数据更新为LATEST COSMOSDB COLLECTION
(如果是新的)。如果有其他设备在线使用较新的数据,则此数据是我们想要保存到LATEST COLLECTION中的数据。

Our problem is that the devices con be offline generating data with timestamp from our sensors in an offline way. When the device sync into IoT will send all the sensors data of the room. This data we only want to be updated into LATEST COSMOSDB COLLECTION if it is new. If there is another device that was online with newer data, this data is the data we want to mantain into LATEST COLLECTION.

为此目的我在考虑在StreamAnalytics(IoT hub)和2个输出中输入一个单一输入。一个包含来自设备的所有数据。另一个输出与每个房间的最低温度。因此,当我需要最新的温度时,我有一个收集
的信息。我无法使用流分析的查询语言。将COsmosDB作为输入也很棒,所以我只能在新的时候更新数据。但我不认为可以做到。

For this purpose I was thinking on having one single input in StreamAnalytics (IoT hub) and 2 Outputs. One with all the data from devices. And another output with the latests temperature of every room. So when I need the latest temperature I have a collection with this information. I'm not able to do so with the query language of stream analytics. It will be fantastic to have COsmosDB as Input too so I can only UPDATE data if it is new. But I don't see it can be done.

¿有关如何处理问题的任何想法?

¿Any Idea in how to approach the problem?

推荐答案

您好mgoyena,

Hi mgoyena,

One Stream Analytics作业可以有多个查询步骤和多个输出。您可以参考以下博文中的示例:

One Stream Analytics job can have multiple query steps and multiple output. You can reference the examples in below blog posts:

https://blogs.msdn.microsoft.com/streamanalytics/2015/09/16/query-pattern-of-the-week-send -data-to-multiple-outputs /

https://blogs.msdn.microsoft.com/streamanalytics/2015/06/05/can-i-use-multiple-with-clauses/

目前,不支持使用Cosmos DB作为Azure Stream Analytics的输入。

Currently, Cosmos DB is not supported as input for Azure Stream Analytics.

我建议你投票另一位Azure客户提交的想法。

I would suggest you to vote up an idea submitted by another Azure customer.

https://feedback.azure.com/forums/597982-azure-database-for-mysql/suggestions/19753714-dba-permissions-in-mysql

所有的feedb您在这些论坛中分享的确认将由负责构建Azure的Microsoft工程团队进行监控和审核。

All of the feedback you share in these forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure.

希望这会有所帮助。


这篇关于仅在需要时根据时间戳更新CosmosDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆