如何EVENTDATA的序列化大小配料来决定? [英] How can the serialized size of EventData be determined for batching?
问题描述
在为Azure的 EventHubClient 有<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.eventhubclient.sendbatch.aspx\"相对=nofollow>双 <一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.eventhubclient.sendbatchasync.aspx\"相对=nofollow> 的方法,用于发送一批数据他们每个人都有下面的注释,将抛出一个<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.messagesizeexceededexception.aspx\"相对=nofollow> MessageSizeExceededException 如果它被忽略。
In the documentation for the Azure EventHubClient there are two methods for sending a batch of data each of them has the remark below and will throw a MessageSizeExceededException if it is ignored.
您应该确保eventDataList的总序列的大小小于一个事件的数据传输的尺寸的限制,这是256K默认
You should ensure that the total serialized size of eventDataList is less than the size limit of one event data transmission, which is 256k by default.
一个类似的警告是在编程指南
如何的IEnumerable&LT的系列大小; EVENTDATA&GT; eventDataList
确定?
传递到每个字节的大小EVENTDATA 是很容易确定,假设你没有<一个href=\"http://stackoverflow.com/questions/27241679/why-cant-eventdata-getbytes-be-called-before-sending\">ask在EVENTDATA 的。然而,EVENTDATA presumably的序列化形式包括<一个href=\"http://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.messaging.eventdata.partitionkey.aspx\"相对=nofollow>分区键和<一个href=\"http://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.messaging.eventdata.properties.aspx\"相对=nofollow>用户作为<一个使用的属性href=\"https://$c$c.msdn.microsoft.com/windowsapps/Service-Bus-Event-Hub-286fd097/source$c$c?fileId=125837&pathId=2088418849\"相对=nofollow>样本。
The size of the bytes passed to each EventData is easy enough to determine, assuming you don't ask the EventData. However, the serialized form of an EventData presumably includes the Partition Key and user properties as used in the sample.
data.Properties.Add("Type","Telemetry_" + DateTime.Now.ToLongTimeString());
目前我唯一的选择看起来是保守与批量大小。
Currently my only option looks like being conservative with batch sizing.
推荐答案
----更新的NuGet更新后----
这里的EVENTDATA属性 - <一个href=\"https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.eventdata.serializedsizeinbytes.aspx\"相对=nofollow> SerializedSizeInBytes ,我们在我们最近的SDK迭代介绍 - 它解决这一特定问题 - 适用于所有的 SDK nugets以上2.6 。
----Updating after the Nuget Update---- Here's the EventData property - SerializedSizeInBytes that we introduced in our recent SDK iteration - which addresses this specific problem - available in all sdk nugets above 2.6 .
心连心!
SREE
HTH! Sree
这篇关于如何EVENTDATA的序列化大小配料来决定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!