我正在使用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。