问题描述
我的Event Hub返回的EventData对象包含这些信息...
The EventData object returned by my Event Hub contains this information...
当我通过"await client.receiveBatch(..)检索这个时,我可以看到这个。 。)"电话。
I can see this when I retrieve this via an "await client.receiveBatch(...)" call.
{ body:
{ messageText:
'{-----<MessageBody>-----}' },
_raw_amqp_mesage:
Message {
message_annotations:
{ 'x-opt-sequence-number': 16,
'x-opt-offset': '8224',
'x-opt-enqueued-time': 1556207357609 },
body:
Section {
typecode: 117,
content:
<Buffer 7b 22 6d 65 73 73 61 67 65 54 65 78 74 22 3a 22 7b 5c 22 64 65 76 69 63 65 49 64 5c 22 3a 5c 22 52 61 6e 67 61 44 65 76 69 63 65 2d 42 47 2e 78 6d 6c ... >,
multiple: undefined } },
annotations:
{ 'x-opt-sequence-number': 16,
'x-opt-offset': '8224',
'x-opt-enqueued-time': 1556207357609 },
sequenceNumber: 16,
enqueuedTimeUtc: 2019-04-25T15:49:17.609Z,
offset: '8224' }
然而,当我使用它时,我无法访问sequenceNumber在StreamAnalytics的查询...
However, I am not able to access the sequenceNumber when I use it in a query for StreamAnalytics...
我的查询是:
我需要(PartionId,sequenceNumber)的组合在我的输出表中是唯一的。
I need the combination of (PartionId,sequenceNumber) to be unique in my output table.
此查询为sequenceNumber返回null。我尝试使用前缀EventData.sequenceNumber。
This query returns null for my sequenceNumber. I tried prefixing EventData.sequenceNumber.
请有人指出我正确的方向。
Can someone point me in the right direction please.
推荐答案
使用Event Hub作为IoT Hub路由的端点时,您可以使用 GetMetadataPropertyValue函数。
When using Event Hub as an endpoint for IoT Hub Routes, you can access to the IoT Hub metadata using the GetMetadataPropertyValue function.
要从事件中心输入查询, SELECT GetMetadataPropertyValue(ehInput,'[EventHub]。[ EventEnqueuedUtcTime]')AS mytime FROM ehInput 其他有效的属性名称是EventProcessedUtcTime,PartitionId,Offset,SequenceNumber,PartitionKey。
To query from an Event Hub input, SELECT GetMetadataPropertyValue(ehInput, '[EventHub].[EventEnqueuedUtcTime]') AS mytime FROM ehInput Other valid property names are EventProcessedUtcTime, PartitionId, Offset, SequenceNumber, PartitionKey.
有关详细信息,请参阅"来自事件中心的流数据" 。
For more details, refer "Stream data from Event Hubs".
希望这会有所帮助。
这篇关于Event Hub输入的EventData对象不返回sequenceNumber值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!