2

我正在使用AzureSBLite包装器来轮询来自eventhub具有特定分区的消息。事件数据将被发送到一个事件中心,流分析将从那里读取。处理后流分析会将其写入特定分区中的不同事件中心。

SenderEventHub[Partition-1]-->Stream Analytics -->ReciverEventHub[Partition-2]

接收部分通常采用60-150s接收方法,这里不应该是这种情况。我不确定包装中发生了什么以及它在哪里。我已经验证了 的输出streamanalytics,它几乎是即时的,但接收器什么也没得到。


接收代码


ServiceBusConnectionStringBuilder builder = new ServiceBusConnectionStringBuilder(Helper.ConnectionString);

                    builder.TransportType = TransportType.Amqp;

                    MessagingFactory MessagingFactory = MessagingFactory.CreateFromConnectionString(Helper.ConnectionString);

                    EventHubClient client = MessagingFactory.CreateEventHubClient(eventHubEntity as string);

                    EventHubConsumerGroup group = client.GetConsumerGroup(Helper.ConsumerGroup);

                    EventHubReceiver receiver = group.CreateReceiver(Helper.PartitionReciever); 

                    do
                    {
                        EventData data = receiver.Receive();

                        if (data != null)
                        {
                            Debug.WriteLine(Helper.Currentoffset = data.Offset);

                            var msg = JsonConvert.DeserializeObject<EventBody>(Encoding.UTF8.GetString(data.GetBytes()));

                            if (msg != null) Helper.Speak(msg.CommandName);
                        }
                    } while (true);

在此处输入图像描述

尝试使用 Same EventHub 但两个不同的分区更糟糕。


在此处输入图像描述

注意:Windows 10 IoT Core 不支持 Azure.SeriveBus。因此无法使用 EventProcessorHost。

4

0 回答 0