none
[E2010][EWSMA][C#] Creating a separate subscription per folder per mailbox as opposed to a subscription per mailbox for all folders RRS feed

  • Question

  • I have a Windows service that subscribes to streaming notifications on Contacts, Tasks, and Calendar folders on 70 mailboxes. While implementing it, I ran into a small dilemma.

    If I just have one subscription for each mailbox that subscribes to all three folders, then when I receive a notification on a given subscription, then I don't immediately know which notification this folder occurred on. I would have to bind to the given item ID and check the type of the item. But, I wouldn't do anything else with this bound item since I use SyncFolderItems to actually figure out what's changed on a given folder. The notification just tells me I need to sync.

    So, I can avoid binding to the item if I have one subscription per folder per mailbox and then map each subscription ID to a folder-mailbox pair. That way, I know immediately what folder/mailbox to sync with when I get a notification.

    I seem to be having some problems with the Exchange Web Services being loaded with too much traffic. I need to do some more investigation into what all of the traffic specifically is, but I'm curious about the approach I took here.

    I wouldn't think that there would be a significant difference between these two approaches in terms of performance except that the latter will make 3 times more service calls to initially set up the subscriptions. If streaming notifications are the best of push/pull, and this is all still using a single StreamingSubscriptionConnection, then the amount of traffic should essentially be the same, right?

    Thank you,

    Tedderz

    Wednesday, September 7, 2011 7:43 PM

Answers

  • Hi,

    what kind of problems are you seeing? Does the responsiveness of the EWS request degrade or do you get more errors? This could be caused by an EWS throttling policy being active on the server (see http://blogs.technet.com/b/exchange/archive/2010/08/27/3410837.aspx).

    That being said, I don't quite see your dilemma here. The NotificationEvent class, from which all notification instances are derived, contains a ParentFolderId which specifies which folder the event occurred in. What you should do is to bind to each folder instance once (at application startup) and cache its FolderId. You can then compare the NotificationEvent.ParentFolderId with the cached ids and thus determine which folder was affected.

    Kind regards,
    Henning

    • Marked as answer by Tedderz Thursday, September 8, 2011 4:03 PM
    Wednesday, September 7, 2011 9:58 PM

All replies

  • Hi,

    what kind of problems are you seeing? Does the responsiveness of the EWS request degrade or do you get more errors? This could be caused by an EWS throttling policy being active on the server (see http://blogs.technet.com/b/exchange/archive/2010/08/27/3410837.aspx).

    That being said, I don't quite see your dilemma here. The NotificationEvent class, from which all notification instances are derived, contains a ParentFolderId which specifies which folder the event occurred in. What you should do is to bind to each folder instance once (at application startup) and cache its FolderId. You can then compare the NotificationEvent.ParentFolderId with the cached ids and thus determine which folder was affected.

    Kind regards,
    Henning

    • Marked as answer by Tedderz Thursday, September 8, 2011 4:03 PM
    Wednesday, September 7, 2011 9:58 PM
  • It works fine for about a day and a half, and then it starts getting timeouts and connection terminated errors. Then eventually it just gets 503: server unavailable. IT tells me that the web services got overloaded and he had to iisreset on the server hosting the web services for it to work again.

    We turned throttling off for the service account about a week ago, and it didn't seem to change anything. We used the "Turn off client throttling.." section of the BES manual as an example to follow.

    http://docs.blackberry.com/en/admin/deliverables/12044/BlackBerry_Enterprise_Server_for_Microsoft_Exchange-Installation_and_Configuration_Guide--819071-1029033521-001-5.0.1-US.pdf

    That's a good idea; not sure why it didn't cross my mind before... is there an ExchangeService.BindToItems() equivalent for folders? Otherwise, it looks like I'd have to go from making 3 subscription service calls to 1 subscription call and 3 Folder.Bind() calls to set things up for a given mailbox. Then if I do all of that and it turns out that there wasn't really a significant difference in performance between a subscription per folder per mailbox and a subscription for all three folders per mailbox, then I may as well go back to what I initially had, correct?

    Thursday, September 8, 2011 1:41 PM
  • Yeah, if the solution I outlined does not improve your situation, you might as well get back to the current one.

    You are also correct with the assumption that there is no way to avoid those 3 Folder.Bind() calls per mailbox. But IMHO, this should not be a problem.

    An idea to get to the root of the issue would be to analyze the IIS logs on the Exchange box to get a feeling about the EWS calls made by your application. If there are any spikes or an increasing number of calls over time.

    Also, monitor the CAS performance counters for a while:
    http://technet.microsoft.com/en-us/library/ff367877.aspx

    Kind regards,
    Henning Krause

    Thursday, September 8, 2011 2:17 PM