The sample client library's reconnexion code does not segments its requests. It can exceed bindings limits when there are many items in a subscription. In that case, reconnexion can fail silently.
We propose the following correction in the file /SampleApplications/SampleLibraries/Client/Subscription.cs, line around 831, function Create :
// For big subscriptions, the create requests should be splitted in several
// smaller ones. The limit seems to be between 30k and 40k for our use cases,
// so splitting in requests of 1000 items should be sufficient. We do not split
// inside CreateItems to modify only reconnection code, as the other paths are
// already handled by upper layers in our classes. Our goal here is to keep
// SDK modifications as small as possible.
// First, copy the item map in order to refill it:
int iTotalCount = m_monitoredItems.Count;
if (iTotalCount != 0)
{
KeyValuePair<uint, MonitoredItem>[] arrayItems = new KeyValuePair<uint, MonitoredItem>[iTotalCount];
m_monitoredItems.CopyTo(arrayItems, 0);
// Then refill it:
m_monitoredItems = new SortedDictionary<uint, MonitoredItem>();
int iItem = 0;
while (iItem < iTotalCount)
{
int iCurrent;
for (iCurrent = iItem; iCurrent < iTotalCount && iCurrent - iItem < 1000; ++iCurrent)
m_monitoredItems.Add(arrayItems[iCurrent].Key, arrayItems[iCurrent].Value);
CreateItems();
iItem = iCurrent;
}
}
ChangesCompleted();
The sample client library's reconnexion code does not segments its requests. It can exceed bindings limits when there are many items in a subscription. In that case, reconnexion can fail silently.
We propose the following correction in the file /SampleApplications/SampleLibraries/Client/Subscription.cs, line around 831, function Create :